summaryrefslogtreecommitdiffstats
path: root/fs/fuse
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2016-10-03 11:06:05 +0200
committerMiklos Szeredi <mszeredi@redhat.com>2016-10-03 11:06:05 +0200
commit63401ccdb2ca08ae76909f6588a3f3348bc3555d (patch)
treec11152318b15a203e49d4b8d6aacea3d9548f166 /fs/fuse
parentfuse: remove duplicate cs->offset assignment (diff)
downloadlinux-63401ccdb2ca08ae76909f6588a3f3348bc3555d.tar.xz
linux-63401ccdb2ca08ae76909f6588a3f3348bc3555d.zip
fuse: limit xattr returned size
Don't let userspace filesystem give bogus values for the size of xattr and xattr list. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to '')
-rw-r--r--fs/fuse/xattr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/fuse/xattr.c b/fs/fuse/xattr.c
index 04b097f29d8a..3caac46b08b0 100644
--- a/fs/fuse/xattr.c
+++ b/fs/fuse/xattr.c
@@ -79,7 +79,7 @@ ssize_t fuse_getxattr(struct inode *inode, const char *name, void *value,
}
ret = fuse_simple_request(fc, &args);
if (!ret && !size)
- ret = outarg.size;
+ ret = min_t(ssize_t, outarg.size, XATTR_SIZE_MAX);
if (ret == -ENOSYS) {
fc->no_getxattr = 1;
ret = -EOPNOTSUPP;
@@ -138,7 +138,7 @@ ssize_t fuse_listxattr(struct dentry *entry, char *list, size_t size)
}
ret = fuse_simple_request(fc, &args);
if (!ret && !size)
- ret = outarg.size;
+ ret = min_t(ssize_t, outarg.size, XATTR_LIST_MAX);
if (ret > 0 && size)
ret = fuse_verify_xattr_list(list, ret);
if (ret == -ENOSYS) {