summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Cernekee <cernekee@gmail.com>2014-11-09 00:55:47 -0800
committerRob Herring <robh@kernel.org>2014-11-18 11:35:02 -0600
commitab74d00a39f70e1bc34a01322bb59f3750ca7a8c (patch)
tree22e4264309f563decae0165926e1171fd98be14c
parent66865de4314caca30598244b86817e774c188afa (diff)
downloadblackbird-obmc-linux-ab74d00a39f70e1bc34a01322bb59f3750ca7a8c.tar.gz
blackbird-obmc-linux-ab74d00a39f70e1bc34a01322bb59f3750ca7a8c.zip
of: Fix crash if an earlycon driver is not found
__earlycon_of_table_sentinel.compatible is a char[128], not a pointer, so it will never be NULL. Checking it against NULL causes the match loop to run past the end of the array, and eventually match a bogus entry, under the following conditions: - Kernel command line specifies "earlycon" with no parameters - DT has a stdout-path pointing to a UART node - The UART driver doesn't use OF_EARLYCON_DECLARE (or maybe the console driver is compiled out) Fix this by checking to see if match->compatible is a non-empty string. Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Cc: <stable@vger.kernel.org> # 3.16+ Signed-off-by: Rob Herring <robh@kernel.org>
-rw-r--r--drivers/of/fdt.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index d1ffca8b34ea..30e97bcc4f88 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -773,7 +773,7 @@ int __init early_init_dt_scan_chosen_serial(void)
if (offset < 0)
return -ENODEV;
- while (match->compatible) {
+ while (match->compatible[0]) {
unsigned long addr;
if (fdt_node_check_compatible(fdt, offset, match->compatible)) {
match++;
OpenPOWER on IntegriCloud