deepin-kernel/fs/efivarfs
James Bottomley 710643b7fe efivarfs: Fix error on non-existent file
commit 2ab0837cb9 upstream.

When looking up a non-existent file, efivarfs returns -EINVAL if the
file does not conform to the NAME-GUID format and -ENOENT if it does.
This is caused by efivars_d_hash() returning -EINVAL if the name is not
formatted correctly.  This error is returned before simple_lookup()
returns a negative dentry, and is the error value that the user sees.

Fix by removing this check.  If the file does not exist, simple_lookup()
will return a negative dentry leading to -ENOENT and efivarfs_create()
already has a validity check before it creates an entry (and will
correctly return -EINVAL)

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: <stable@vger.kernel.org>
[ardb: make efivarfs_valid_name() static]
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-12-30 11:01:05 +08: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: Fix error on non-existent file 2024-12-30 11:01:05 +08:00
internal.h efivarfs: Fix error on non-existent file 2024-12-30 11:01:05 +08:00
super.c efivarfs: Fix error on non-existent file 2024-12-30 11:01:05 +08:00
vars.c efivarfs: Request at most 512 bytes for variable names 2024-03-06 14:48:41 +00:00