From: Chao Yu Date: Sat, 22 Mar 2014 06:59:45 +0000 (+0800) Subject: f2fs: avoid unneeded lookup when xattr name length is too long X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6e452d69d421e10e99446c6de16a19604149c40f;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Jaegeuk Kim --- 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, 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)