]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ARC: U-boot: check arguments paranoidly
authorEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Thu, 14 Feb 2019 15:07:44 +0000 (18:07 +0300)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 2 May 2019 20:41:57 +0000 (21:41 +0100)
commit4404926390d1d3104e4949a6f42717be3f30a23c
tree4af12ad166adf849ad1578439bbd924cf59ff3b6
parent17b676ec70edf5cafdd2794c88f9d197a49fb30b
ARC: U-boot: check arguments paranoidly

commit a66f2e57bd566240d8b3884eedf503928fbbe557 upstream.

Handle U-boot arguments paranoidly:
 * don't allow to pass unknown tag.
 * try to use external device tree blob only if corresponding tag
   (TAG_DTB) is set.
 * don't check uboot_tag if kernel build with no ARC_UBOOT_SUPPORT.

NOTE:
If U-boot args are invalid we skip them and try to use embedded device
tree blob. We can't panic on invalid U-boot args as we really pass
invalid args due to bug in U-boot code.
This happens if we don't provide external DTB to U-boot and
don't set 'bootargs' U-boot environment variable (which is default
case at least for HSDK board) In that case we will pass
{r0 = 1 (bootargs in r2); r1 = 0; r2 = 0;} to linux which is invalid.

While I'm at it refactor U-boot arguments handling code.

Tested-by: Corentin LABBE <clabbe@baylibre.com>
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
arch/arc/kernel/head.S
arch/arc/kernel/setup.c