Skip to content

Commit

Permalink
gsmi: fix null-deref in gsmi_get_variable
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Khazhismel Kumykov authored and Greg Kroah-Hartman committed Jan 20, 2023
1 parent 96b328d commit a769b05
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/firmware/google/gsmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,10 @@ static efi_status_t gsmi_get_variable(efi_char16_t *name,
memcpy(data, gsmi_dev.data_buf->start, *data_size);

/* All variables are have the following attributes */
*attr = EFI_VARIABLE_NON_VOLATILE |
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS;
if (attr)
*attr = EFI_VARIABLE_NON_VOLATILE |
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS;
}

spin_unlock_irqrestore(&gsmi_dev.lock, flags);
Expand Down

0 comments on commit a769b05

Please sign in to comment.