All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] efi/x86: Fix the deletion of variables in mixed mode
@ 2020-04-08  8:16 Gary Lin
  2020-04-08  8:20 ` Ard Biesheuvel
  2020-04-14  8:20 ` [tip: efi/urgent] " tip-bot2 for Gary Lin
  0 siblings, 2 replies; 3+ messages in thread
From: Gary Lin @ 2020-04-08  8:16 UTC (permalink / raw)
  To: linux-efi; +Cc: Gary Lin, Ard Biesheuvel, Ingo Molnar, Thomas Gleixner

efi_thunk_set_variable() treated the NULL "data" pointer as an invalid
parameter, and this broke the deletion of variables in mixed mode.
This commit fixes the check of data so that the userspace program can
delete a variable in mixed mode.

Fixes: 8319e9d5ad98ffcc ("efi/x86: Handle by-ref arguments covering multiple pages in mixed mode")
Cc: linux-efi@vger.kernel.org
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Gary Lin <glin@suse.com>
---
 arch/x86/platform/efi/efi_64.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index 211bb9358b73..e0e2e8136cf5 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -638,7 +638,7 @@ efi_thunk_set_variable(efi_char16_t *name, efi_guid_t *vendor,
 	phys_vendor = virt_to_phys_or_null(vnd);
 	phys_data = virt_to_phys_or_null_size(data, data_size);
 
-	if (!phys_name || !phys_data)
+	if (!phys_name || (data && !phys_data))
 		status = EFI_INVALID_PARAMETER;
 	else
 		status = efi_thunk(set_variable, phys_name, phys_vendor,
@@ -669,7 +669,7 @@ efi_thunk_set_variable_nonblocking(efi_char16_t *name, efi_guid_t *vendor,
 	phys_vendor = virt_to_phys_or_null(vnd);
 	phys_data = virt_to_phys_or_null_size(data, data_size);
 
-	if (!phys_name || !phys_data)
+	if (!phys_name || (data && !phys_data))
 		status = EFI_INVALID_PARAMETER;
 	else
 		status = efi_thunk(set_variable, phys_name, phys_vendor,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] efi/x86: Fix the deletion of variables in mixed mode
  2020-04-08  8:16 [PATCH] efi/x86: Fix the deletion of variables in mixed mode Gary Lin
@ 2020-04-08  8:20 ` Ard Biesheuvel
  2020-04-14  8:20 ` [tip: efi/urgent] " tip-bot2 for Gary Lin
  1 sibling, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2020-04-08  8:20 UTC (permalink / raw)
  To: Gary Lin; +Cc: linux-efi, Ingo Molnar, Thomas Gleixner

On Wed, 8 Apr 2020 at 10:18, Gary Lin <glin@suse.com> wrote:
>
> efi_thunk_set_variable() treated the NULL "data" pointer as an invalid
> parameter, and this broke the deletion of variables in mixed mode.
> This commit fixes the check of data so that the userspace program can
> delete a variable in mixed mode.
>
> Fixes: 8319e9d5ad98ffcc ("efi/x86: Handle by-ref arguments covering multiple pages in mixed mode")
> Cc: linux-efi@vger.kernel.org
> Cc: Ard Biesheuvel <ardb@kernel.org>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Gary Lin <glin@suse.com>

Thanks Gary.

I'll queue this in efi/urgent.



> ---
>  arch/x86/platform/efi/efi_64.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
> index 211bb9358b73..e0e2e8136cf5 100644
> --- a/arch/x86/platform/efi/efi_64.c
> +++ b/arch/x86/platform/efi/efi_64.c
> @@ -638,7 +638,7 @@ efi_thunk_set_variable(efi_char16_t *name, efi_guid_t *vendor,
>         phys_vendor = virt_to_phys_or_null(vnd);
>         phys_data = virt_to_phys_or_null_size(data, data_size);
>
> -       if (!phys_name || !phys_data)
> +       if (!phys_name || (data && !phys_data))
>                 status = EFI_INVALID_PARAMETER;
>         else
>                 status = efi_thunk(set_variable, phys_name, phys_vendor,
> @@ -669,7 +669,7 @@ efi_thunk_set_variable_nonblocking(efi_char16_t *name, efi_guid_t *vendor,
>         phys_vendor = virt_to_phys_or_null(vnd);
>         phys_data = virt_to_phys_or_null_size(data, data_size);
>
> -       if (!phys_name || !phys_data)
> +       if (!phys_name || (data && !phys_data))
>                 status = EFI_INVALID_PARAMETER;
>         else
>                 status = efi_thunk(set_variable, phys_name, phys_vendor,
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip: efi/urgent] efi/x86: Fix the deletion of variables in mixed mode
  2020-04-08  8:16 [PATCH] efi/x86: Fix the deletion of variables in mixed mode Gary Lin
  2020-04-08  8:20 ` Ard Biesheuvel
@ 2020-04-14  8:20 ` tip-bot2 for Gary Lin
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Gary Lin @ 2020-04-14  8:20 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Gary Lin, Ard Biesheuvel, Ingo Molnar, x86, LKML

The following commit has been merged into the efi/urgent branch of tip:

Commit-ID:     a4b81ccfd4caba017d2b84720b6de4edd16911a0
Gitweb:        https://git.kernel.org/tip/a4b81ccfd4caba017d2b84720b6de4edd16911a0
Author:        Gary Lin <glin@suse.com>
AuthorDate:    Thu, 09 Apr 2020 15:04:33 +02:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Tue, 14 Apr 2020 08:32:16 +02:00

efi/x86: Fix the deletion of variables in mixed mode

efi_thunk_set_variable() treated the NULL "data" pointer as an invalid
parameter, and this broke the deletion of variables in mixed mode.
This commit fixes the check of data so that the userspace program can
delete a variable in mixed mode.

Fixes: 8319e9d5ad98ffcc ("efi/x86: Handle by-ref arguments covering multiple pages in mixed mode")
Signed-off-by: Gary Lin <glin@suse.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20200408081606.1504-1-glin@suse.com
Link: https://lore.kernel.org/r/20200409130434.6736-9-ardb@kernel.org
---
 arch/x86/platform/efi/efi_64.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index 211bb93..e0e2e81 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -638,7 +638,7 @@ efi_thunk_set_variable(efi_char16_t *name, efi_guid_t *vendor,
 	phys_vendor = virt_to_phys_or_null(vnd);
 	phys_data = virt_to_phys_or_null_size(data, data_size);
 
-	if (!phys_name || !phys_data)
+	if (!phys_name || (data && !phys_data))
 		status = EFI_INVALID_PARAMETER;
 	else
 		status = efi_thunk(set_variable, phys_name, phys_vendor,
@@ -669,7 +669,7 @@ efi_thunk_set_variable_nonblocking(efi_char16_t *name, efi_guid_t *vendor,
 	phys_vendor = virt_to_phys_or_null(vnd);
 	phys_data = virt_to_phys_or_null_size(data, data_size);
 
-	if (!phys_name || !phys_data)
+	if (!phys_name || (data && !phys_data))
 		status = EFI_INVALID_PARAMETER;
 	else
 		status = efi_thunk(set_variable, phys_name, phys_vendor,

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-14  8:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-08  8:16 [PATCH] efi/x86: Fix the deletion of variables in mixed mode Gary Lin
2020-04-08  8:20 ` Ard Biesheuvel
2020-04-14  8:20 ` [tip: efi/urgent] " tip-bot2 for Gary Lin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.