Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <baofeng.tian@intel.com>
Signed-off-by: Luo XinanX <xinanx.luo@intel.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

authored by

Tian Baofeng and committed by
Ard Biesheuvel
975a6166 919aef44

+7 -5
+7 -5
drivers/firmware/efi/efibc.c
··· 43 43 efibc_str_to_str16(value, (efi_char16_t *)entry->var.Data); 44 44 memcpy(&entry->var.VendorGuid, &guid, sizeof(guid)); 45 45 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 + 51 53 if (ret) 52 54 pr_err("failed to set %s EFI variable: 0x%x\n", 53 55 name, ret);