kobject: kobject_add() reference leak
authorCornelia Huck <cornelia.huck@de.ibm.com>
Tue, 10 Apr 2007 12:35:27 +0000 (14:35 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 27 Apr 2007 17:57:30 +0000 (10:57 -0700)
We leak a reference if we attempt to add a kobject with no name.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
lib/kobject.c

index db1d23707eb14f1593e120a944f28d2711f48910..eb251aae78dd94c3cb3f48101af8dd0cdca15526 100644 (file)
@@ -174,6 +174,7 @@ int kobject_shadow_add(struct kobject * kobj, struct dentry *shadow_parent)
        if (!*kobj->k_name) {
                pr_debug("kobject attempted to be registered with no name!\n");
                WARN_ON(1);
+               kobject_put(kobj);
                return -EINVAL;
        }
        parent = kobject_get(kobj->parent);