[Patch -mm] kobject: kobject_add() reference leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



<This patch is the "pathological case" in the referenced mail.>

We leak a reference if we attempt to add a kobject with no name.

Signed-off-by: Cornelia Huck <[email protected]>

---
 lib/kobject.c |    1 +
 1 files changed, 1 insertion(+)

--- linux-2.6.21-rc6-mm1.orig/lib/kobject.c
+++ linux-2.6.21-rc6-mm1/lib/kobject.c
@@ -218,6 +218,7 @@ int kobject_shadow_add(struct kobject * 
 	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);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux