Skip to content

Commit 24427cd

Browse files
timschumiardbiesheuvel
authored andcommitted
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 f45812c ("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>
1 parent 4cece76 commit 24427cd

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

drivers/firmware/efi/efi-pstore.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,15 @@ static ssize_t efi_pstore_read(struct pstore_record *record)
162162
efi_status_t status;
163163

164164
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;
166174

167175
/*
168176
* If this is the first read() call in the pstore enumeration,

0 commit comments

Comments
 (0)