[PATCH] kobject: fix double kobject_put() in error path of kobject_add()

From: Greg KH
Date: Tue Nov 09 2004 - 14:07:54 EST

This fixes a problem introduced in the previous set of driver model
changes that has been seen by a lot of people (most notibly the greater
than 256 pty users, but others might also be hitting this without
realizing it.)

Also add a comment so we don't try to "fix" this again.

Signed-off-by: Greg Kroah-Hartman <greg@xxxxxxxxx>

--- a/lib/kobject.c 2004-11-05 10:06:33 -08:00
+++ b/lib/kobject.c 2004-11-08 23:58:02 -08:00
@@ -181,10 +181,10 @@ int kobject_add(struct kobject * kobj)

error = create_dir(kobj);
if (error) {
+ /* unlink does the kobject_put() for us */
if (parent)
- kobject_put(kobj);
} else {
kobject_hotplug(kobj, KOBJ_ADD);
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/