Skip to content

Commit 975a616

Browse files
btian1Ard Biesheuvel
authored andcommitted
efibc: Replace variable set function in notifier call
Replace the variable set function from "efivar_entry_set" to "efivar_entry_set_safe" in efibc panic notifier. In safe function parameter "block" will set to false and will call "efivar_entry_set_nonblocking"to set efi variables. efivar_entry_set_nonblocking is guaranteed to not block and is suitable for calling from crash/panic handlers. In UEFI android platform, when warm reset happens, with this change, efibc will not block the reboot process. Otherwise, set variable will call queue work and send to other offlined cpus then cause another panic, finally will cause reboot failure. Signed-off-by: Tian Baofeng <[email protected]> Signed-off-by: Luo XinanX <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]>
1 parent 919aef4 commit 975a616

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

drivers/firmware/efi/efibc.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,13 @@ static int efibc_set_variable(const char *name, const char *value)
4343
efibc_str_to_str16(value, (efi_char16_t *)entry->var.Data);
4444
memcpy(&entry->var.VendorGuid, &guid, sizeof(guid));
4545

46-
ret = efivar_entry_set(entry,
47-
EFI_VARIABLE_NON_VOLATILE
48-
| EFI_VARIABLE_BOOTSERVICE_ACCESS
49-
| EFI_VARIABLE_RUNTIME_ACCESS,
50-
size, entry->var.Data, NULL);
46+
ret = efivar_entry_set_safe(entry->var.VariableName,
47+
entry->var.VendorGuid,
48+
EFI_VARIABLE_NON_VOLATILE
49+
| EFI_VARIABLE_BOOTSERVICE_ACCESS
50+
| EFI_VARIABLE_RUNTIME_ACCESS,
51+
false, size, entry->var.Data);
52+
5153
if (ret)
5254
pr_err("failed to set %s EFI variable: 0x%x\n",
5355
name, ret);

0 commit comments

Comments
 (0)