From: Ross Lagerwall <ross.lagerwall@citrix.com>
To: <linux-efi@vger.kernel.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Darren Hart <dvhart@infradead.org>,
Andy Shevchenko <andy@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
"H. Peter Anvin" <hpa@zytor.com>, <x86@kernel.org>,
<platform-driver-x86@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
"Sai Praneeth" <sai.praneeth.prakhya@intel.com>,
Ross Lagerwall <ross.lagerwall@citrix.com>
Subject: [PATCH] x86/efi: Don't require non-blocking EFI callbacks
Date: Thu, 26 Sep 2019 15:12:34 +0100 [thread overview]
Message-ID: <20190926141234.8271-1-ross.lagerwall@citrix.com> (raw)
If a backend does not implement non-blocking EFI operations, it implies
that the normal operations are non-blocking. Instead of crashing
dereferencing a NULL pointer, fallback to the normal operations since it
is safe to do so.
Fixes: 5a58bc1b1edc ("efi/x86: Use non-blocking SetVariable() for efi_delete_dummy_variable()")
Fixes: ca0e30dcaa53 ("efi: Add nonblocking option to efi_query_variable_store()")
Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
---
arch/x86/platform/efi/quirks.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/arch/x86/platform/efi/quirks.c b/arch/x86/platform/efi/quirks.c
index 3b9fd679cea9..4167f5e8f3e8 100644
--- a/arch/x86/platform/efi/quirks.c
+++ b/arch/x86/platform/efi/quirks.c
@@ -106,11 +106,13 @@ early_param("efi_no_storage_paranoia", setup_storage_paranoia);
*/
void efi_delete_dummy_variable(void)
{
- efi.set_variable_nonblocking((efi_char16_t *)efi_dummy_name,
- &EFI_DUMMY_GUID,
- EFI_VARIABLE_NON_VOLATILE |
- EFI_VARIABLE_BOOTSERVICE_ACCESS |
- EFI_VARIABLE_RUNTIME_ACCESS, 0, NULL);
+ efi_set_variable_t *set_variable = efi.set_variable_nonblocking ?:
+ efi.set_variable;
+
+ set_variable((efi_char16_t *)efi_dummy_name, &EFI_DUMMY_GUID,
+ EFI_VARIABLE_NON_VOLATILE |
+ EFI_VARIABLE_BOOTSERVICE_ACCESS |
+ EFI_VARIABLE_RUNTIME_ACCESS, 0, NULL);
}
/*
@@ -127,10 +129,12 @@ query_variable_store_nonblocking(u32 attributes, unsigned long size)
{
efi_status_t status;
u64 storage_size, remaining_size, max_size;
+ efi_query_variable_info_t *query_variable_info =
+ efi.query_variable_info_nonblocking ?:
+ efi.query_variable_info;
- status = efi.query_variable_info_nonblocking(attributes, &storage_size,
- &remaining_size,
- &max_size);
+ status = query_variable_info(attributes, &storage_size,
+ &remaining_size, &max_size);
if (status != EFI_SUCCESS)
return status;
--
2.21.0
next reply other threads:[~2019-09-26 14:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-26 14:12 Ross Lagerwall [this message]
2019-09-26 15:29 ` [PATCH] x86/efi: Don't require non-blocking EFI callbacks Ard Biesheuvel
2019-09-26 15:46 ` Ross Lagerwall
2019-09-26 15:47 ` Ard Biesheuvel
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=20190926141234.8271-1-ross.lagerwall@citrix.com \
--to=ross.lagerwall@citrix.com \
--cc=andy@infradead.org \
--cc=ard.biesheuvel@linaro.org \
--cc=bp@alien8.de \
--cc=dvhart@infradead.org \
--cc=hpa@zytor.com \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=sai.praneeth.prakhya@intel.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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