diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index 5ad27e484014fdf2cce3df1895089ae4955fe269..e28ab91d973d4bd1e214f0591a8318149b28bd64 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c @@ -465,6 +465,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 @@ -495,8 +498,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; }