Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

efi: pstore: Request at most 512 bytes for variable names

Work around a quirk in a few old (2011-ish) UEFI implementations, where
a call to `GetNextVariableName` with a buffer size larger than 512 bytes
will always return EFI_INVALID_PARAMETER.

This was already done to efivarfs in commit f45812cc23fb ("efivarfs:
Request at most 512 bytes for variable names"), but the second copy of
the variable iteration implementation was overlooked.

Signed-off-by: Tim Schumacher <timschumi@gmx.de>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>

authored by

Tim Schumacher and committed by
Ard Biesheuvel
24427cda 4cece764

+9 -1
+9 -1
drivers/firmware/efi/efi-pstore.c
··· 162 162 efi_status_t status; 163 163 164 164 for (;;) { 165 - varname_size = 1024; 165 + /* 166 + * A small set of old UEFI implementations reject sizes 167 + * above a certain threshold, the lowest seen in the wild 168 + * is 512. 169 + * 170 + * TODO: Commonize with the iteration implementation in 171 + * fs/efivarfs to keep all the quirks in one place. 172 + */ 173 + varname_size = 512; 166 174 167 175 /* 168 176 * If this is the first read() call in the pstore enumeration,