kobject: new_device->kref wasn't putted after error in kobject_move()
authorDmitriy Monakhov <dmonakhov@sw.ru>
Sat, 3 Mar 2007 13:11:21 +0000 (16:11 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 9 Mar 2007 23:32:58 +0000 (15:32 -0800)
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 <dmonakhov@openvz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
lib/kobject.c

index f4f6176dcd1286313c57ae80239ec1f0f7bbf65e..057921c5945a551777f56706b397c5e4f737aaf3 100644 (file)
@@ -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);