* FAILED: patch "[PATCH] CIFS: check new file size when extending file by fallocate" failed to apply to 5.4-stable tree
@ 2020-04-14 14:09 gregkh
2020-04-18 6:43 ` Murphy Zhou
0 siblings, 1 reply; 2+ messages in thread
From: gregkh @ 2020-04-14 14:09 UTC (permalink / raw)
To: jencce.kernel, lsahlber, stable, stfrench; +Cc: stable
The patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From ef4a632ccc1c7d3fb71a5baae85b79af08b7f94b Mon Sep 17 00:00:00 2001
From: Murphy Zhou <jencce.kernel@gmail.com>
Date: Wed, 18 Mar 2020 20:43:38 +0800
Subject: [PATCH] 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>
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);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: FAILED: patch "[PATCH] CIFS: check new file size when extending file by fallocate" failed to apply to 5.4-stable tree
2020-04-14 14:09 FAILED: patch "[PATCH] CIFS: check new file size when extending file by fallocate" failed to apply to 5.4-stable tree gregkh
@ 2020-04-18 6:43 ` Murphy Zhou
0 siblings, 0 replies; 2+ messages in thread
From: Murphy Zhou @ 2020-04-18 6:43 UTC (permalink / raw)
To: gregkh; +Cc: jencce.kernel, lsahlber, stable, stfrench
On Tue, Apr 14, 2020 at 04:09:39PM +0200, gregkh@linuxfoundation.org wrote:
>
> The patch below does not apply to the 5.4-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <stable@vger.kernel.org>.
It depends on other commits which does not suit stable, so skip this
patch on stable trees that does not apply cleanly.
Thanks!
>
> thanks,
>
> greg k-h
>
> ------------------ original commit in Linus's tree ------------------
>
> From ef4a632ccc1c7d3fb71a5baae85b79af08b7f94b Mon Sep 17 00:00:00 2001
> From: Murphy Zhou <jencce.kernel@gmail.com>
> Date: Wed, 18 Mar 2020 20:43:38 +0800
> Subject: [PATCH] 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>
>
> 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);
>
>
--
Murphy
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-18 6:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-14 14:09 FAILED: patch "[PATCH] CIFS: check new file size when extending file by fallocate" failed to apply to 5.4-stable tree gregkh
2020-04-18 6:43 ` Murphy Zhou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).