From 88db4721d47bc59b92d46de04e21c7975ea983f2 Mon Sep 17 00:00:00 2001 From: Cornelia Huck Date: Tue, 10 Apr 2007 14:35:27 +0200 Subject: [PATCH] kobject: kobject_add() reference leak We leak a reference if we attempt to add a kobject with no name. Signed-off-by: Cornelia Huck Signed-off-by: Greg Kroah-Hartman --- lib/kobject.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/kobject.c b/lib/kobject.c index db1d237..eb251aa 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -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); -- 2.7.4