Skip to content
Snippets Groups Projects
Commit 6b2f49a9 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Yongqiang Liu
Browse files

configfs: return -ENAMETOOLONG earlier in configfs_lookup

mainline inclusion
from mainline-v5.15-rc1
commit 417b962ddeca2b70eb72d28c87541bdad4e234f8
category: bugfix
bugzilla: 187567, https://gitee.com/openeuler/kernel/issues/I5PK1G


CVE: NA

--------------------------------

Just like most other file systems: get the simple checks out of the
way first.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarZhihao Cheng <chengzhihao1@huawei.com>
Reviewed-by: default avatarZhang Yi <yi.zhang@huawei.com>
Signed-off-by: default avatarYongqiang Liu <liuyongqiang13@huawei.com>
parent b3ed949d
No related branches found
No related tags found
No related merge requests found
......@@ -483,6 +483,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
......@@ -513,8 +516,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;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment