Skip to content

Commit 081d515

Browse files
xypronardbiesheuvel
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ard Biesheuvel <[email protected]>
1 parent a088b85 commit 081d515

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/firmware/efi/libstub/arm-stub.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ static struct screen_info *setup_graphics(void)
6060
si = alloc_screen_info();
6161
if (!si)
6262
return NULL;
63-
efi_setup_gop(si, &gop_proto, size);
63+
status = efi_setup_gop(si, &gop_proto, size);
64+
if (status != EFI_SUCCESS) {
65+
free_screen_info(si);
66+
return NULL;
67+
}
6468
}
6569
return si;
6670
}

0 commit comments

Comments
 (0)