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@xxxxxxxxxxxxxxxxxxxxx> --- fs/efivarfs/super.c | 3 --- 1 file changed, 3 deletions(-) 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); -- 2.35.3