[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.0701081103530.4249-100000@iolanthe.rowland.org>
Date: Mon, 8 Jan 2007 11:06:44 -0500 (EST)
From: Alan Stern <stern@...land.harvard.edu>
To: Greg KH <greg@...ah.com>, Kay Sievers <kay.sievers@...ell.com>
cc: Kernel development list <linux-kernel@...r.kernel.org>
Subject: [PATCH] Driver core: fix refcounting bug
This patch (as832) fixes a newly-introduced bug in the driver core.
When a kobject is assigned to a kset, it must acquire a reference to
the kset.
Signed-off-by: Alan Stern <stern@...land.harvard.edu>
---
The bug was introduced in Kay's "unify /sys/class and /sys/bus at
/sys/subsystem" patch.
I left the assignment of class_dev->kobj.parent as it was, although it is
not needed. The following call to kobject_add() will end up doing the
same thing.
Alan Stern
P.S.: Tracking down refcounting bugs is a real pain! I spent an entire
afternoon on this one... :-(
Index: usb-2.6/drivers/base/class.c
===================================================================
--- usb-2.6.orig/drivers/base/class.c
+++ usb-2.6/drivers/base/class.c
@@ -648,7 +648,7 @@ int class_device_add(struct class_device
class_dev->kobj.parent = &parent_class_dev->kobj;
else {
/* assign parent kset for uevent hook */
- class_dev->kobj.kset = &parent_class->devices_dir;
+ class_dev->kobj.kset = kset_get(&parent_class->devices_dir);
/* the device directory in /sys/subsystem/<name>/devices */
class_dev->kobj.parent = &parent_class->devices_dir.kobj;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists