aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2007-05-16 02:57:24 -0400
committerPaul Mackerras <paulus@samba.org>2007-05-17 07:11:15 -0400
commit847f5976f90d5637a86a826c1c594091d08f3156 (patch)
tree5226c33114ee798626a870e4de14c4c10bd31fba /arch/powerpc
parentc72ea777d4e51435388fbd863c813a19635fa8ef (diff)
[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 <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/kernel/prom.c5
1 files changed, 5 insertions, 0 deletions
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)
1472 node->name = of_get_property(node, "name", NULL); 1472 node->name = of_get_property(node, "name", NULL);
1473 node->type = of_get_property(node, "device_type", NULL); 1473 node->type = of_get_property(node, "device_type", NULL);
1474 1474
1475 if (!node->name)
1476 node->name = "<NULL>";
1477 if (!node->type)
1478 node->type = "<NULL>";
1479
1475 if (!parent) { 1480 if (!parent) {
1476 err = -ENODEV; 1481 err = -ENODEV;
1477 goto out; 1482 goto out;