mirror of
https://git.proxmox.com/git/efi-boot-shim
synced 2025-06-06 16:52:30 +00:00
Don't free GetVariable() return data without checking the status code.
This breaks every machine from before Secure Boot was a thing. Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
parent
83b3a7cf6d
commit
556c445ea1
15
shim.c
15
shim.c
@ -456,21 +456,30 @@ static BOOLEAN secure_mode (void)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
status = get_variable(L"SecureBoot", &Data, &len, global_var);
|
status = get_variable(L"SecureBoot", &Data, &len, global_var);
|
||||||
|
if (status != EFI_SUCCESS) {
|
||||||
|
if (verbose)
|
||||||
|
console_notify(L"Secure boot not enabled\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
sb = *Data;
|
sb = *Data;
|
||||||
FreePool(Data);
|
FreePool(Data);
|
||||||
|
|
||||||
/* FIXME - more paranoia here? */
|
if (sb != 1) {
|
||||||
if (status != EFI_SUCCESS || sb != 1) {
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
console_notify(L"Secure boot not enabled\n");
|
console_notify(L"Secure boot not enabled\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = get_variable(L"SetupMode", &Data, &len, global_var);
|
status = get_variable(L"SetupMode", &Data, &len, global_var);
|
||||||
|
if (status == EFI_SUCCESS) {
|
||||||
|
if (verbose)
|
||||||
|
console_notify(L"Platform is in setup mode\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
setupmode = *Data;
|
setupmode = *Data;
|
||||||
FreePool(Data);
|
FreePool(Data);
|
||||||
|
|
||||||
if (status == EFI_SUCCESS && setupmode == 1) {
|
if (setupmode == 1) {
|
||||||
if (verbose)
|
if (verbose)
|
||||||
console_notify(L"Platform is in setup mode\n");
|
console_notify(L"Platform is in setup mode\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
Loading…
Reference in New Issue
Block a user