Skip to content

Commit

Permalink
kobject: new_device->kref wasn't putted after error in kobject_move()
Browse files Browse the repository at this point in the history
If error happen we jump to "out" label, in this case new_device not yet
became the parent but it wasn't putted.

Signed-off-by: Monakhov Dmitriy <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Dmitriy Monakhov authored and gregkh committed Mar 9, 2007
1 parent a2807db commit 9e993ef
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/kobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,9 +385,11 @@ int kobject_move(struct kobject *kobj, struct kobject *new_parent)
goto out;
old_parent = kobj->parent;
kobj->parent = new_parent;
new_parent = NULL;
kobject_put(old_parent);
kobject_uevent_env(kobj, KOBJ_MOVE, envp);
out:
kobject_put(new_parent);
kobject_put(kobj);
kfree(devpath_string);
kfree(devpath);
Expand Down

0 comments on commit 9e993ef

Please sign in to comment.