linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: baofeng.tian@intel.com
To: ard.biesheuvel@linaro.org, linux-efi@vger.kernel.org,
	jeremy.compostella@intel.com, ming.tan@intel.com,
	qihua.zhuang@intel.com
Cc: Tian Baofeng <baofeng.tian@intel.com>, Luo XinanX <xinanx.luo@intel.com>
Subject: [[efi boot control]] efibc: Replace variable set function in notifier call
Date: Wed, 12 Jun 2019 16:18:10 +0800	[thread overview]
Message-ID: <20190612081810.26526-1-baofeng.tian@intel.com> (raw)

From: Tian Baofeng <baofeng.tian@intel.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@intel.com>
Signed-off-by: Luo XinanX <xinanx.luo@intel.com>
---
 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.21.0


             reply	other threads:[~2019-06-12  8:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-12  8:18 baofeng.tian [this message]
2019-06-20  0:45 ` [[efi boot control]] efibc: Replace variable set function in notifier call Tian, Baofeng
2019-06-21 16:04 ` Ard Biesheuvel
  -- strict thread matches above, loose matches on Subject: below --
2019-06-12  8:15 baofeng.tian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190612081810.26526-1-baofeng.tian@intel.com \
    --to=baofeng.tian@intel.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=jeremy.compostella@intel.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=ming.tan@intel.com \
    --cc=qihua.zhuang@intel.com \
    --cc=xinanx.luo@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).