summaryrefslogtreecommitdiffstats
path: root/fs/configfs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-08-25 07:42:44 +0200
committerChristoph Hellwig <hch@lst.de>2021-08-25 07:42:44 +0200
commit417b962ddeca2b70eb72d28c87541bdad4e234f8 (patch)
tree1b49f30213eb43714fd43c25df983f86b32695e7 /fs/configfs
parent769f52676756b8c5feb302d2d95af59577fc69ec (diff)
downloadlinux-417b962ddeca2b70eb72d28c87541bdad4e234f8.tar.bz2
configfs: return -ENAMETOOLONG earlier in configfs_lookup
Just like most other file systems: get the simple checks out of the way first. Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/configfs')
-rw-r--r--fs/configfs/dir.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index ac5e0c0e9181..cf08bbde55f3 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -456,6 +456,9 @@ static struct dentry * configfs_lookup(struct inode *dir,
int found = 0;
int err;
+ if (dentry->d_name.len > NAME_MAX)
+ return ERR_PTR(-ENAMETOOLONG);
+
/*
* Fake invisibility if dir belongs to a group/default groups hierarchy
* being attached
@@ -486,8 +489,6 @@ static struct dentry * configfs_lookup(struct inode *dir,
* If it doesn't exist and it isn't a NOT_PINNED item,
* it must be negative.
*/
- if (dentry->d_name.len > NAME_MAX)
- return ERR_PTR(-ENAMETOOLONG);
d_add(dentry, NULL);
return NULL;
}