From: Greg Kroah-Hartman <gregkh@suse.de>
To: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, maneesh@in.ibm.com
Subject: [patch 1/7] Driver core: potentially fix use after free in class_device_attr_show
Date: Tue, 16 Aug 2005 15:15:48 -0700 [thread overview]
Message-ID: <20050816221548.GB28619@kroah.com> (raw)
In-Reply-To: <20050816221527.GA28619@kroah.com>
[-- Attachment #1: driver-use-after-free-fix-for-class_device_attr_show.patch --]
[-- Type: text/plain, Size: 1314 bytes --]
From: Maneesh Soni <maneesh@in.ibm.com>
o moves the code to free devt_attr from class_device_del() to
class_dev_release() which is called after the last reference to the
corresponding kobject() is gone. This allows to keep the devt_attr
alive while the corresponding sysfs file is open.
Signed-off-by: Maneesh Soni <maneesh@in.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/base/class.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
--- gregkh-2.6.orig/drivers/base/class.c 2005-08-16 14:51:44.000000000 -0700
+++ gregkh-2.6/drivers/base/class.c 2005-08-16 14:56:58.000000000 -0700
@@ -299,6 +299,11 @@ static void class_dev_release(struct kob
pr_debug("device class '%s': release.\n", cd->class_id);
+ if (cd->devt_attr) {
+ kfree(cd->devt_attr);
+ cd->devt_attr = NULL;
+ }
+
if (cls->release)
cls->release(cd);
else {
@@ -591,11 +596,8 @@ void class_device_del(struct class_devic
if (class_dev->dev)
sysfs_remove_link(&class_dev->kobj, "device");
- if (class_dev->devt_attr) {
+ if (class_dev->devt_attr)
class_device_remove_file(class_dev, class_dev->devt_attr);
- kfree(class_dev->devt_attr);
- class_dev->devt_attr = NULL;
- }
class_device_remove_attrs(class_dev);
kobject_hotplug(&class_dev->kobj, KOBJ_REMOVE);
--
next prev parent reply other threads:[~2005-08-16 22:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20050816220001.699316000@press.kroah.org>
2005-08-16 22:15 ` [patch 0/7] fixes for 2.6.13-rc6 Greg Kroah-Hartman
2005-08-16 22:15 ` Greg Kroah-Hartman [this message]
2005-08-16 22:15 ` [patch 2/7] PCI: 6700/6702PXH quirk Greg Kroah-Hartman
2005-08-16 22:16 ` [patch 3/7] PCI: fix quirk-6700-fix.patch Greg Kroah-Hartman
2005-08-17 0:27 ` Andrew Morton
2005-08-17 18:45 ` Greg KH
2005-08-16 22:16 ` [patch 4/7] PCI Hotplug: new contact info Greg Kroah-Hartman
2005-08-16 22:16 ` [patch 5/7] PCI: update documentation Greg Kroah-Hartman
2005-08-16 22:16 ` [patch 6/7] USB: fix usb wacom tablet driver bug Greg Kroah-Hartman
2005-08-16 22:16 ` [patch 7/7] USB: usbmon: Copyrights and a typo Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050816221548.GB28619@kroah.com \
--to=gregkh@suse.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maneesh@in.ibm.com \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox