Commit 2b6ba494 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by Linus Torvalds

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

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: default avatarGreg Kroah-Hartman <greg@kroah.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 175ac86f
......@@ -180,10 +180,10 @@ int kobject_add(struct kobject * kobj)
error = create_dir(kobj);
if (error) {
/* unlink does the kobject_put() for us */
unlink(kobj);
if (parent)
kobject_put(parent);
kobject_put(kobj);
} else {
kobject_hotplug(kobj, KOBJ_ADD);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment