Skip to content

Commit 417b962

Browse files
author
Christoph Hellwig
committed
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>
1 parent 769f526 commit 417b962

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

fs/configfs/dir.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,9 @@ static struct dentry * configfs_lookup(struct inode *dir,
456456
int found = 0;
457457
int err;
458458

459+
if (dentry->d_name.len > NAME_MAX)
460+
return ERR_PTR(-ENAMETOOLONG);
461+
459462
/*
460463
* Fake invisibility if dir belongs to a group/default groups hierarchy
461464
* being attached
@@ -486,8 +489,6 @@ static struct dentry * configfs_lookup(struct inode *dir,
486489
* If it doesn't exist and it isn't a NOT_PINNED item,
487490
* it must be negative.
488491
*/
489-
if (dentry->d_name.len > NAME_MAX)
490-
return ERR_PTR(-ENAMETOOLONG);
491492
d_add(dentry, NULL);
492493
return NULL;
493494
}

0 commit comments

Comments
 (0)