[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20190622085106.24859-5-ard.biesheuvel@linaro.org>
Date: Sat, 22 Jun 2019 10:51:06 +0200
From: Ard Biesheuvel <ard.biesheuvel@...aro.org>
To: linux-efi@...r.kernel.org, Ingo Molnar <mingo@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>
Cc: Ard Biesheuvel <ard.biesheuvel@...aro.org>,
linux-kernel@...r.kernel.org, Hans de Goede <hdegoede@...hat.com>,
Jonathan Richardson <jonathan.richardson@...adcom.com>,
Luo XinanX <xinanx.luo@...el.com>,
"Prakhya, Sai Praneeth" <sai.praneeth.prakhya@...el.com>,
Qian Cai <cai@....pw>, Tian Baofeng <baofeng.tian@...el.com>
Subject: [PATCH 4/4] efibc: Replace variable set function in notifier call
From: Tian Baofeng <baofeng.tian@...el.com>
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@...el.com>
Signed-off-by: Luo XinanX <xinanx.luo@...el.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@...aro.org>
---
drivers/firmware/efi/efibc.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/firmware/efi/efibc.c b/drivers/firmware/efi/efibc.c
index 61e099826cbb..35dccc88ac0a 100644
--- a/drivers/firmware/efi/efibc.c
+++ b/drivers/firmware/efi/efibc.c
@@ -43,11 +43,13 @@ static int efibc_set_variable(const char *name, const char *value)
efibc_str_to_str16(value, (efi_char16_t *)entry->var.Data);
memcpy(&entry->var.VendorGuid, &guid, sizeof(guid));
- ret = efivar_entry_set(entry,
- EFI_VARIABLE_NON_VOLATILE
- | EFI_VARIABLE_BOOTSERVICE_ACCESS
- | EFI_VARIABLE_RUNTIME_ACCESS,
- size, entry->var.Data, NULL);
+ ret = efivar_entry_set_safe(entry->var.VariableName,
+ entry->var.VendorGuid,
+ EFI_VARIABLE_NON_VOLATILE
+ | EFI_VARIABLE_BOOTSERVICE_ACCESS
+ | EFI_VARIABLE_RUNTIME_ACCESS,
+ false, size, entry->var.Data);
+
if (ret)
pr_err("failed to set %s EFI variable: 0x%x\n",
name, ret);
--
2.20.1
Powered by blists - more mailing lists