Skip to content

Commit a769b05

Browse files
Khazhismel Kumykovgregkh
authored andcommitted
gsmi: fix null-deref in gsmi_get_variable
We can get EFI variables without fetching the attribute, so we must allow for that in gsmi. commit 8597482 ("efi: pstore: Omit efivars caching EFI varstore access layer") added a new get_variable call with attr=NULL, which triggers panic in gsmi. Fixes: 74c5b31 ("driver: Google EFI SMI") Cc: stable <stable@kernel.org> Signed-off-by: Khazhismel Kumykov <khazhy@google.com> Link: https://lore.kernel.org/r/20230118010212.1268474-1-khazhy@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 96b328d commit a769b05

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/firmware/google/gsmi.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,10 @@ static efi_status_t gsmi_get_variable(efi_char16_t *name,
361361
memcpy(data, gsmi_dev.data_buf->start, *data_size);
362362

363363
/* All variables are have the following attributes */
364-
*attr = EFI_VARIABLE_NON_VOLATILE |
365-
EFI_VARIABLE_BOOTSERVICE_ACCESS |
366-
EFI_VARIABLE_RUNTIME_ACCESS;
364+
if (attr)
365+
*attr = EFI_VARIABLE_NON_VOLATILE |
366+
EFI_VARIABLE_BOOTSERVICE_ACCESS |
367+
EFI_VARIABLE_RUNTIME_ACCESS;
367368
}
368369

369370
spin_unlock_irqrestore(&gsmi_dev.lock, flags);

0 commit comments

Comments
 (0)