OpenCloudOS-Kernel/fs/efivarfs
Tim Schumacher 71da10e633 efivarfs: Request at most 512 bytes for variable names
commit f45812cc23fb74bef62d4eb8a69fe7218f4b9f2a upstream.

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.

There is some lore around EFI variable names being up to 1024 bytes in
size, but this has no basis in the UEFI specification, and the upper
bounds are typically platform specific, and apply to the entire variable
(name plus payload).

Given that Linux does not permit creating files with names longer than
NAME_MAX (255) bytes, 512 bytes (== 256 UTF-16 characters) is a
reasonable limit.

Cc: <stable@vger.kernel.org> # 6.1+
Signed-off-by: Tim Schumacher <timschumi@gmx.de>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-06 14:48:41 +00:00
..
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile efi: vars: Move efivar caching layer into efivarfs 2022-06-24 20:40:19 +02:00
file.c efivarfs: convert to ctime accessor functions 2023-07-13 10:28:06 +02:00
inode.c efivarfs: convert to ctime accessor functions 2023-07-13 10:28:06 +02:00
internal.h efi: vars: Move efivar caching layer into efivarfs 2022-06-24 20:40:19 +02:00
super.c efivarfs: Free s_fs_info on unmount 2024-01-25 15:35:15 -08:00
vars.c efivarfs: Request at most 512 bytes for variable names 2024-03-06 14:48:41 +00:00