Commit c1d867a5 authored by Dave Jones's avatar Dave Jones Committed by Linus Torvalds

fs/proc/proc_devtree.c: remove empty /proc/device-tree when no openfirmware exists.

Distribution kernels might want to build in support for /proc/device-tree
for kernels that might end up running on hardware that doesn't support
openfirmware.  This results in an empty /proc/device-tree existing.
Remove it if the OFW root node doesn't exist.

This situation actually confuses grub2, resulting in install failures.
grub2 sees the /proc/device-tree and picks the wrong install target cf.
http://bzr.savannah.gnu.org/lh/grub/trunk/grub/annotate/4300/util/grub-install.in#L311
grub should be more robust, but still, leaving an empty proc dir seems
pointless.

Addresses https://bugzilla.redhat.com/show_bug.cgi?id=818378.
Signed-off-by: default avatarDave Jones <davej@redhat.com>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Josh Boyer <jwboyer@fedoraproject.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent cdf7e8dd
...@@ -232,6 +232,7 @@ void __init proc_device_tree_init(void) ...@@ -232,6 +232,7 @@ void __init proc_device_tree_init(void)
return; return;
root = of_find_node_by_path("/"); root = of_find_node_by_path("/");
if (root == NULL) { if (root == NULL) {
remove_proc_entry("device-tree", NULL);
pr_debug("/proc/device-tree: can't find root\n"); pr_debug("/proc/device-tree: can't find root\n");
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment