aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChao Yu <chao2.yu@samsung.com>2014-03-22 14:59:45 +0800
committerZiyan <jaraidaniel@gmail.com>2015-05-02 14:36:40 +0200
commit4a1d6c2bdbf9f1afea362446c470e5e2487bdb88 (patch)
tree96033e63dd56c76e49a2bea23184ef202ad394ca /fs
parent9c312174602bf1cf448d847d5633215e94a090fc (diff)
downloadkernel_samsung_tuna-4a1d6c2bdbf9f1afea362446c470e5e2487bdb88.zip
kernel_samsung_tuna-4a1d6c2bdbf9f1afea362446c470e5e2487bdb88.tar.gz
kernel_samsung_tuna-4a1d6c2bdbf9f1afea362446c470e5e2487bdb88.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)