powerpc/prom_init: Check display props exist before enabling btext
authorMichael Ellerman <mpe@ellerman.id.au>
Fri, 21 Aug 2020 10:34:07 +0000 (20:34 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 18 Sep 2020 09:59:44 +0000 (19:59 +1000)
commit6c71cfcc01685ef495ca7886471a76e73446424e
treeb5bffbaa5ca84786d43fb88299494cd15d69467d
parent39f87561454dc33efb2a3d8354d066207acac8a6
powerpc/prom_init: Check display props exist before enabling btext

It's possible to enable CONFIG_PPC_EARLY_DEBUG_BOOTX for a pseries
kernel (maybe it shouldn't be), which is then booted with qemu/slof.

But if you do that the kernel crashes in draw_byte(), with a DAR
pointing somewhere near INT_MAX.

Adding some debug to prom_init we see that we're not able to read the
"address" property from OF, so we're just using whatever junk value
was on the stack.

So check the properties can be read properly from OF, if not we bail
out before initialising btext, which avoids the crash.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Link: https://lore.kernel.org/r/20200821103407.3362149-1-mpe@ellerman.id.au
arch/powerpc/kernel/prom_init.c