* [GIT PATCH] driver core fixes for 2.6.33-rc8
@ 2010-02-17 0:02 Greg KH
2010-02-17 0:11 ` [PATCH 1/2] sysfs: sysfs_sd_setattr set iattrs unconditionally Greg Kroah-Hartman
2010-02-17 0:11 ` [PATCH 2/2] class: Free the class private data in class_release Greg Kroah-Hartman
0 siblings, 2 replies; 3+ messages in thread
From: Greg KH @ 2010-02-17 0:02 UTC (permalink / raw)
To: Linus Torvalds, Andrew Morton; +Cc: linux-kernel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] sysfs: sysfs_sd_setattr set iattrs unconditionally
2010-02-17 0:02 [GIT PATCH] driver core fixes for 2.6.33-rc8 Greg KH
@ 2010-02-17 0:11 ` Greg Kroah-Hartman
2010-02-17 0:11 ` [PATCH 2/2] class: Free the class private data in class_release Greg Kroah-Hartman
1 sibling, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2010-02-17 0:11 UTC (permalink / raw)
To: linux-kernel; +Cc: Eric W. Biederman, stable, Greg Kroah-Hartman
From: Eric W. Biederman <ebiederm@xmission.com>
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.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Tested-by: Jean Delvare <khali@linux-fr.org>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
fs/sysfs/inode.c | 35 +++++++++++++++++------------------
1 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
index 220b758..6a06a1d 100644
--- a/fs/sysfs/inode.c
+++ b/fs/sysfs/inode.c
@@ -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;
}
--
1.7.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] class: Free the class private data in class_release
2010-02-17 0:02 [GIT PATCH] driver core fixes for 2.6.33-rc8 Greg KH
2010-02-17 0:11 ` [PATCH 1/2] sysfs: sysfs_sd_setattr set iattrs unconditionally Greg Kroah-Hartman
@ 2010-02-17 0:11 ` Greg Kroah-Hartman
1 sibling, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2010-02-17 0:11 UTC (permalink / raw)
To: linux-kernel; +Cc: Laurent Pinchart, stable, Greg Kroah-Hartman
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Fix a memory leak by freeing the memory allocated in __class_register
for the class private data.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/base/class.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/base/class.c b/drivers/base/class.c
index 161746d..6e2c3b0 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -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 = {
--
1.7.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-02-17 0:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-17 0:02 [GIT PATCH] driver core fixes for 2.6.33-rc8 Greg KH
2010-02-17 0:11 ` [PATCH 1/2] sysfs: sysfs_sd_setattr set iattrs unconditionally Greg Kroah-Hartman
2010-02-17 0:11 ` [PATCH 2/2] class: Free the class private data in class_release Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).