diff mbox series

[1/3] efivarfs: fix error on non-existent file

Message ID 20241208183415.21181-2-James.Bottomley@HansenPartnership.com
State New
Headers show
Series efivarfs: bug fixes | expand

Commit Message

James Bottomley Dec. 8, 2024, 6:34 p.m. UTC
efivarfs returns -EINVAL if the non-existing file .doesn't conform to
the NAME-GUID format and -ENOENT if it does.  This is caused by
efivars_d_hash returning -EINVAL if the name isn't formatted
correctly.  This error is returned before simple_lookup returns a
negative dentry and is what the user sees.  Fix by removing this
check.  If the file doesn't 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>
---
 fs/efivarfs/super.c | 3 ---
 1 file changed, 3 deletions(-)
diff mbox series

Patch

diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c
index a929f1b613be..beba15673be8 100644
--- a/fs/efivarfs/super.c
+++ b/fs/efivarfs/super.c
@@ -144,9 +144,6 @@  static int efivarfs_d_hash(const struct dentry *dentry, struct qstr *qstr)
 	const unsigned char *s = qstr->name;
 	unsigned int len = qstr->len;
 
-	if (!efivarfs_valid_name(s, len))
-		return -EINVAL;
-
 	while (len-- > EFI_VARIABLE_GUID_LEN)
 		hash = partial_name_hash(*s++, hash);