diff options
| author | Chao Yu <chao2.yu@samsung.com> | 2014-03-22 02:59:45 -0400 |
|---|---|---|
| committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2014-04-01 05:54:24 -0400 |
| commit | 6e452d69d421e10e99446c6de16a19604149c40f (patch) | |
| tree | 78236f48ae6d645bb9a918181e06ce8f53ae8aa8 | |
| parent | df0f8dc0e154de13e3a54846f384b674dd557c85 (diff) | |
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>
| -rw-r--r-- | fs/f2fs/xattr.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c index 0121e4595ccd..503c2451131e 100644 --- a/fs/f2fs/xattr.c +++ b/fs/f2fs/xattr.c | |||
| @@ -407,6 +407,8 @@ int f2fs_getxattr(struct inode *inode, int name_index, const char *name, | |||
| 407 | if (name == NULL) | 407 | if (name == NULL) |
| 408 | return -EINVAL; | 408 | return -EINVAL; |
| 409 | name_len = strlen(name); | 409 | name_len = strlen(name); |
| 410 | if (name_len > F2FS_NAME_LEN) | ||
| 411 | return -ERANGE; | ||
| 410 | 412 | ||
| 411 | base_addr = read_all_xattrs(inode, NULL); | 413 | base_addr = read_all_xattrs(inode, NULL); |
| 412 | if (!base_addr) | 414 | if (!base_addr) |
