aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChao Yu <chao2.yu@samsung.com>2014-03-22 14:59:45 +0800
committerAndreas Blaesius <skate4life@gmx.de>2016-06-05 21:21:24 +0200
commit9dd449c8e6d925dfedefb3f7b673eddfa4042364 (patch)
treeede4239def536d4394b559274f0c2aec47c0a482 /fs
parente7ea74936b4ac63e0e0a904d373c0f7c98caee73 (diff)
downloadkernel_samsung_espresso10-9dd449c8e6d925dfedefb3f7b673eddfa4042364.zip
kernel_samsung_espresso10-9dd449c8e6d925dfedefb3f7b673eddfa4042364.tar.gz
kernel_samsung_espresso10-9dd449c8e6d925dfedefb3f7b673eddfa4042364.tar.bz2
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/f2fs/xattr.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
index acd7158..359a467 100644
--- a/fs/f2fs/xattr.c
+++ b/fs/f2fs/xattr.c
@@ -425,6 +425,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)