Skip to content

Commit ef4a632

Browse files
Murphy Zhousmfrench
authored andcommitted
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 <[email protected]> Signed-off-by: Murphy Zhou <[email protected]> Signed-off-by: Steve French <[email protected]> CC: Stable <[email protected]>
1 parent 8895c66 commit ef4a632

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

fs/cifs/smb2ops.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3255,6 +3255,10 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon,
32553255
* Extending the file
32563256
*/
32573257
if ((keep_size == false) && i_size_read(inode) < off + len) {
3258+
rc = inode_newsize_ok(inode, off + len);
3259+
if (rc)
3260+
goto out;
3261+
32583262
if ((cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE) == 0)
32593263
smb2_set_sparse(xid, tcon, cfile, inode, false);
32603264

0 commit comments

Comments
 (0)