summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2020-04-26 21:49:46 +0200
committerArd Biesheuvel <ardb@kernel.org>2020-04-30 23:26:30 +0200
commit081d5150845ba3fa49151a2f55d3cc03b0987509 (patch)
tree682a9e7339b4a44db3b7f9ce223a333a041c88d7 /drivers
parentefi/x86: Revert struct layout change to fix kexec boot regression (diff)
downloadlinux-081d5150845ba3fa49151a2f55d3cc03b0987509.tar.xz
linux-081d5150845ba3fa49151a2f55d3cc03b0987509.zip
efi/libstub: Avoid returning uninitialized data from setup_graphics()
Currently, setup_graphics() ignores the return value of efi_setup_gop(). As AllocatePool() does not zero out memory, the screen information table will contain uninitialized data in this case. We should free the screen information table if efi_setup_gop() returns an error code. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Link: https://lore.kernel.org/r/20200426194946.112768-1-xypron.glpk@gmx.de Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/firmware/efi/libstub/arm-stub.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/firmware/efi/libstub/arm-stub.c b/drivers/firmware/efi/libstub/arm-stub.c
index 99a5cde7c2d8..48161b1dd098 100644
--- a/drivers/firmware/efi/libstub/arm-stub.c
+++ b/drivers/firmware/efi/libstub/arm-stub.c
@@ -60,7 +60,11 @@ static struct screen_info *setup_graphics(void)
si = alloc_screen_info();
if (!si)
return NULL;
- efi_setup_gop(si, &gop_proto, size);
+ status = efi_setup_gop(si, &gop_proto, size);
+ if (status != EFI_SUCCESS) {
+ free_screen_info(si);
+ return NULL;
+ }
}
return si;
}