]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/5.0.19/fuse-honor-rlimit_fsize-in-fuse_file_fallocate.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 5.0.19 / fuse-honor-rlimit_fsize-in-fuse_file_fallocate.patch
1 From 0cbade024ba501313da3b7e5dd2a188a6bc491b5 Mon Sep 17 00:00:00 2001
2 From: Liu Bo <bo.liu@linux.alibaba.com>
3 Date: Thu, 18 Apr 2019 04:04:41 +0800
4 Subject: fuse: honor RLIMIT_FSIZE in fuse_file_fallocate
5
6 From: Liu Bo <bo.liu@linux.alibaba.com>
7
8 commit 0cbade024ba501313da3b7e5dd2a188a6bc491b5 upstream.
9
10 fstests generic/228 reported this failure that fuse fallocate does not
11 honor what 'ulimit -f' has set.
12
13 This adds the necessary inode_newsize_ok() check.
14
15 Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
16 Fixes: 05ba1f082300 ("fuse: add FALLOCATE operation")
17 Cc: <stable@vger.kernel.org> # v3.5
18 Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
19 Signed-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 @@ -2987,6 +2987,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