]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-4.4/fuse-honor-rlimit_fsize-in-fuse_file_fallocate.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.4 / fuse-honor-rlimit_fsize-in-fuse_file_fallocate.patch
CommitLineData
3e0a1a19
GKH
1From 0cbade024ba501313da3b7e5dd2a188a6bc491b5 Mon Sep 17 00:00:00 2001
2From: Liu Bo <bo.liu@linux.alibaba.com>
3Date: Thu, 18 Apr 2019 04:04:41 +0800
4Subject: fuse: honor RLIMIT_FSIZE in fuse_file_fallocate
5
6From: Liu Bo <bo.liu@linux.alibaba.com>
7
8commit 0cbade024ba501313da3b7e5dd2a188a6bc491b5 upstream.
9
10fstests generic/228 reported this failure that fuse fallocate does not
11honor what 'ulimit -f' has set.
12
13This adds the necessary inode_newsize_ok() check.
14
15Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
16Fixes: 05ba1f082300 ("fuse: add FALLOCATE operation")
17Cc: <stable@vger.kernel.org> # v3.5
18Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
19Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20
21---
22 fs/fuse/file.c | 7 +++++++
23 1 file changed, 7 insertions(+)
24
25--- a/fs/fuse/file.c
26+++ b/fs/fuse/file.c
27@@ -2947,6 +2947,13 @@ static long fuse_file_fallocate(struct f
28 }
29 }
30
31+ if (!(mode & FALLOC_FL_KEEP_SIZE) &&
32+ offset + length > i_size_read(inode)) {
33+ err = inode_newsize_ok(inode, offset + length);
34+ if (err)
35+ return err;
36+ }
37+
38 if (!(mode & FALLOC_FL_KEEP_SIZE))
39 set_bit(FUSE_I_SIZE_UNSTABLE, &fi->state);
40