driver core fixes for 2.6.33-rc8
PATCH 1/1 driver core fixes for 2.6.33-rc8
Here are two 2.6.33-rc8 patches for the driver core:
They fix:
- memory leak fix for when struct class is removed from the system.
- regression fix for sysfs loosing their attributes.
Please pull from:
master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-core-2.6.git/
Both of these patches have been in the linux-next and mm trees for a while.
The patches will be sent as a follow-on to this message to lkml for people to see.
thanks,
greg k-h
------------
drivers/base/class.c | 2 ++ fs/sysfs/inode.c | 35 +++++++++++++++++------------------ 2 files changed, 19 insertions(+), 18 deletions(-)
---------------
Eric W. Biederman (1):
sysfs: sysfs_sd_setattr set iattrs unconditionally
Laurent Pinchart (1):
class: Free the class private data in class_release
PATCH 1/2 sysfs: sysfs_sd_setattr set iattrs unconditionally
From: Eric W. Biederman <[email protected]>
There is currently a bug in sysfs_sd_setattr inherited from sysfs_setattr in 2.6.32 where the first time we set the attributes on a sysfs file we allocate backing store but do not set the backing store attributes. Resulting in overly restrictive permissions on sysfs files.
The fix is to simply modify the code so that it always executes when we update the sysfs attributes, as we did in 2.6.31 and earlier.
--- fs/sysfs/inode.c | 35 +++++++++++++++++------------------ 1 files changed, 17 insertions(+), 18 deletions(-)
fs/sysfs/inode.c +17 -18
@@ -81,24 +81,23 @@ int sysfs_sd_setattr(struct sysfs_dirent *sd, struct iattr * iattr)if (!sd_attrs)return -ENOMEM ; sd->s_iattr = sd_attrs; - }else { -/* attributes were changed at least once in past */ - iattrs = &sd_attrs->ia_iattr; - -if (ia_valid &ATTR_UID ) - iattrs->ia_uid = iattr->ia_uid; -if (ia_valid &ATTR_GID ) - iattrs->ia_gid = iattr->ia_gid; -if (ia_valid &ATTR_ATIME ) - iattrs->ia_atime = iattr->ia_atime; -if (ia_valid &ATTR_MTIME ) - iattrs->ia_mtime = iattr->ia_mtime; -if (ia_valid &ATTR_CTIME ) - iattrs->ia_ctime = iattr->ia_ctime; -if (ia_valid &ATTR_MODE ) { -umode_t mode = iattr->ia_mode; - iattrs->ia_mode = sd->s_mode = mode; - } + } +/* attributes were changed at least once in past */ + iattrs = &sd_attrs->ia_iattr; + +if (ia_valid &ATTR_UID ) + iattrs->ia_uid = iattr->ia_uid; +if (ia_valid &ATTR_GID ) + iattrs->ia_gid = iattr->ia_gid; +if (ia_valid &ATTR_ATIME ) + iattrs->ia_atime = iattr->ia_atime; +if (ia_valid &ATTR_MTIME ) + iattrs->ia_mtime = iattr->ia_mtime; +if (ia_valid &ATTR_CTIME ) + iattrs->ia_ctime = iattr->ia_ctime; +if (ia_valid &ATTR_MODE ) { +umode_t mode = iattr->ia_mode; + iattrs->ia_mode = sd->s_mode = mode; }return 0 ; }
Signature · 1 line
1.7.0
PATCH 2/2 class: Free the class private data in class_release
In reply to Greg KHFrom: Laurent Pinchart <[email protected]>
Fix a memory leak by freeing the memory allocated in __class_register for the class private data.
--- drivers/base/class.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/base/class.c +2 -0
@@ -59,6 +59,8 @@ static void class_release(struct kobject *kobj)else pr_debug ("class '%s' does not have a release() function, " "be careful\n" , class->name); + +kfree (cp); }static struct sysfs_ops class_sysfs_ops = {
Signature · 1 line
1.7.0