f2fs: avoid unneeded lookup when xattr name length is too long
In f2fs_setxattr we have limit this attribute name length, so we should also check it in f2fs_getxattr to avoid useless lookup caused by invalid name length. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
This commit is contained in:
parent
df0f8dc0e1
commit
6e452d69d4
@ -407,6 +407,8 @@ int f2fs_getxattr(struct inode *inode, int name_index, const char *name,
|
|||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
name_len = strlen(name);
|
name_len = strlen(name);
|
||||||
|
if (name_len > F2FS_NAME_LEN)
|
||||||
|
return -ERANGE;
|
||||||
|
|
||||||
base_addr = read_all_xattrs(inode, NULL);
|
base_addr = read_all_xattrs(inode, NULL);
|
||||||
if (!base_addr)
|
if (!base_addr)
|
||||||
|
Loading…
Reference in New Issue
Block a user