From: Benjamin Herrenschmidt Date: Wed, 16 May 2007 06:57:24 +0000 (+1000) Subject: [POWERPC] Make sure device node type/name is not NULL on hot-added nodes X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=847f5976f90d5637a86a826c1c594091d08f3156;p=openwrt%2Fstaging%2Fblogic.git [POWERPC] Make sure device node type/name is not NULL on hot-added nodes Our device-tree unflattening code makes sure the name and type fields of a device-node are not NULL. However, the code for dynamically adding devices nodes which is used for pSeries hotplug for example didn't do it, potentially causing crashes in some code that assume it can always do things like strcmp on those. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Paul Mackerras --- diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index c065b5550368..066a6a7a25b8 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c @@ -1472,6 +1472,11 @@ static int of_finish_dynamic_node(struct device_node *node) node->name = of_get_property(node, "name", NULL); node->type = of_get_property(node, "device_type", NULL); + if (!node->name) + node->name = ""; + if (!node->type) + node->type = ""; + if (!parent) { err = -ENODEV; goto out;