]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ARC: u-boot args: check that magic number is correct
authorEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Mon, 25 Feb 2019 17:16:01 +0000 (20:16 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 20 Apr 2019 07:14:59 +0000 (09:14 +0200)
commit8232cdfd5643909f30abe17d8ad9d81459f7feae
tree0c84aa6af5c1d42f678786f772850de68698a619
parent58b454ebf81e5ae9391957d99cf89566d9eec1b1
ARC: u-boot args: check that magic number is correct

[ Upstream commit edb64bca50cd736c6894cc6081d5263c007ce005 ]

In case of devboards we really often disable bootloader and load
Linux image in memory via JTAG. Even if kernel tries to verify
uboot_tag and uboot_arg there is sill a chance that we treat some
garbage in registers as valid u-boot arguments in JTAG case.
E.g. it is enough to have '1' in r0 to treat any value in r2 as
a boot command line.

So check that magic number passed from u-boot is correct and drop
u-boot arguments otherwise. That helps to reduce the possibility
of using garbage as u-boot arguments in JTAG case.

We can safely check U-boot magic value (0x0) in linux passed via
r1 register as U-boot pass it from the beginning. So there is no
backward-compatibility issues.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/arc/kernel/head.S
arch/arc/kernel/setup.c