Skip to content

Commit a4b81cc

Browse files
lcpIngo Molnar
authored andcommitted
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: 8319e9d ("efi/x86: Handle by-ref arguments covering multiple pages in mixed mode") Signed-off-by: Gary Lin <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected]
1 parent 464fb12 commit a4b81cc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/x86/platform/efi/efi_64.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ efi_thunk_set_variable(efi_char16_t *name, efi_guid_t *vendor,
638638
phys_vendor = virt_to_phys_or_null(vnd);
639639
phys_data = virt_to_phys_or_null_size(data, data_size);
640640

641-
if (!phys_name || !phys_data)
641+
if (!phys_name || (data && !phys_data))
642642
status = EFI_INVALID_PARAMETER;
643643
else
644644
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,
669669
phys_vendor = virt_to_phys_or_null(vnd);
670670
phys_data = virt_to_phys_or_null_size(data, data_size);
671671

672-
if (!phys_name || !phys_data)
672+
if (!phys_name || (data && !phys_data))
673673
status = EFI_INVALID_PARAMETER;
674674
else
675675
status = efi_thunk(set_variable, phys_name, phys_vendor,

0 commit comments

Comments
 (0)