diff options
author | Murphy Zhou <jencce.kernel@gmail.com> | 2020-03-18 15:43:38 +0300 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2020-03-23 06:49:10 +0300 |
commit | ef4a632ccc1c7d3fb71a5baae85b79af08b7f94b (patch) | |
tree | a6fde4808538a218a0963f3b7f00dc4e7e26f7dd /fs/cifs/smb2ops.c | |
parent | 8895c66f2b4026346572fd9e92692c06cd9f845c (diff) | |
download | linux-ef4a632ccc1c7d3fb71a5baae85b79af08b7f94b.tar.xz |
CIFS: check new file size when extending file by fallocate
xfstests generic/228 checks if fallocate respect RLIMIT_FSIZE.
After fallocate mode 0 extending enabled, we can hit this failure.
Fix this by check the new file size with vfs helper, return
error if file size is larger then RLIMIT_FSIZE(ulimit -f).
This patch has been tested by LTP/xfstests aginst samba and
Windows server.
Acked-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
CC: Stable <stable@vger.kernel.org>
Diffstat (limited to 'fs/cifs/smb2ops.c')
-rw-r--r-- | fs/cifs/smb2ops.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index b0759c8aa6f5..9c9258fc8756 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -3255,6 +3255,10 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon, * Extending the file */ if ((keep_size == false) && i_size_read(inode) < off + len) { + rc = inode_newsize_ok(inode, off + len); + if (rc) + goto out; + if ((cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE) == 0) smb2_set_sparse(xid, tcon, cfile, inode, false); |