James Bottomley ab765320c0 efivarfs: Fix error on non-existent file
commit 2ab0837cb91b7de507daa145d17b3b6b2efb3abf 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-27 13:52:55 +01:00
..
2024-12-14 19:53:58 +01:00
2024-10-22 15:56:43 +02:00
2024-08-29 17:30:56 +02:00
2022-05-09 16:21:45 -04:00
2024-12-14 19:54:52 +01:00
2022-09-24 07:00:00 +02:00
2022-05-09 16:21:46 -04:00
2022-09-11 20:26:07 -07:00
2024-02-23 09:12:45 +01:00
2023-09-23 11:11:10 +02:00
2022-09-24 07:00:00 +02:00
2022-08-20 11:34:33 -04:00
2024-12-14 19:54:37 +01:00
2023-08-30 16:11:10 +02:00
2022-10-10 14:21:11 -07:00
2022-08-03 10:35:43 -07:00
2023-01-04 11:29:01 +01:00
2022-06-28 13:58:05 -04:00