Skip to content

Commit

Permalink
f2fs: avoid unneeded lookup when xattr name length is too long
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Jaegeuk Kim <[email protected]>
  • Loading branch information
chaseyu authored and Jaegeuk Kim committed Apr 1, 2014
1 parent df0f8dc commit 6e452d6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/f2fs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,8 @@ int f2fs_getxattr(struct inode *inode, int name_index, const char *name,
if (name == NULL)
return -EINVAL;
name_len = strlen(name);
if (name_len > F2FS_NAME_LEN)
return -ERANGE;

base_addr = read_all_xattrs(inode, NULL);
if (!base_addr)
Expand Down

0 comments on commit 6e452d6

Please sign in to comment.