[PATCH] ppc64: fix use kref for device_node refcounting

From: Nathan Lynch
Date: Tue Jan 25 2005 - 23:47:27 EST


On Mon, 2005-01-24 at 02:15 -0800, Andrew Morton wrote:
> ppc64-use-kref-for-device_node-refcounting.patch
> ppc64: use kref for device_node refcounting

This introduced an unbalanced get/put in of_add_node which would cause
newly-added device nodes to be prematurely freed. Sorry for the
screwup, a more rigorously tested fix follows.

Signed-off-by: Nathan Lynch <nathanl@xxxxxxxxxxxxxx>


---


diff -puN arch/ppc64/kernel/prom.c~fix-kref-devnode arch/ppc64/kernel/prom.c
--- linux-2.6.11-rc2-mm1/arch/ppc64/kernel/prom.c~fix-kref-devnode 2005-01-25 21:10:50.000000000 -0600
+++ linux-2.6.11-rc2-mm1-nathanl/arch/ppc64/kernel/prom.c 2005-01-25 21:14:02.000000000 -0600
@@ -1771,6 +1771,7 @@ int of_add_node(const char *path, struct
np->properties = proplist;
OF_MARK_DYNAMIC(np);
kref_init(&np->kref);
+ of_node_get(np);
np->parent = derive_parent(path);
if (!np->parent) {
kfree(np);

_


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/