linux/fs/efivarfs
James Bottomley dedea26a14 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>
History 2024-12-27 14:02:07 +01:00
..
file.c [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
inode.c efivarfs: Fix error on non-existent file 2024-12-27 14:02:07 +01:00
internal.h efivarfs: Fix error on non-existent file 2024-12-27 14:02:07 +01: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
super.c efivarfs: Fix error on non-existent file 2024-12-27 14:02:07 +01:00
vars.c efi: Clear up misconceptions about a maximum variable name size 2024-04-13 10:33:02 +02:00