]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
of: Fix crash if an earlycon driver is not found
authorKevin Cernekee <cernekee@gmail.com>
Sun, 9 Nov 2014 08:55:47 +0000 (00:55 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 6 Dec 2014 23:57:29 +0000 (15:57 -0800)
commitb7b660a4ddc1c09b6eec40a5c211d7082aaa2dd4
tree617e67a5f4693f9582cc20acebe863cfa9340a7c
parent8371a5f957953542639df970e8ac58bb2feace42
of: Fix crash if an earlycon driver is not found

commit ab74d00a39f70e1bc34a01322bb59f3750ca7a8c upstream.

__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>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/of/fdt.c