From: David Howells Date: Mon, 22 May 2023 13:49:49 +0000 (+0100) Subject: splice: Make filemap_splice_read() check s_maxbytes X-Git-Tag: v6.6.7~2609^2~29 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=83aeff881e53fab5b46e4ceb5fb47fa0a22acba9;p=platform%2Fkernel%2Flinux-starfive.git splice: Make filemap_splice_read() check s_maxbytes Make filemap_splice_read() check s_maxbytes analogously to filemap_read(). Signed-off-by: David Howells Reviewed-by: Christoph Hellwig Reviewed-by: Christian Brauner cc: Steve French cc: Jens Axboe cc: Al Viro cc: David Hildenbrand cc: John Hubbard cc: linux-mm@kvack.org cc: linux-block@vger.kernel.org cc: linux-fsdevel@vger.kernel.org Link: https://lore.kernel.org/r/20230522135018.2742245-3-dhowells@redhat.com Signed-off-by: Jens Axboe --- diff --git a/mm/filemap.c b/mm/filemap.c index a200693..0fcb0b8 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2887,6 +2887,9 @@ ssize_t filemap_splice_read(struct file *in, loff_t *ppos, bool writably_mapped; int i, error = 0; + if (unlikely(*ppos >= in->f_mapping->host->i_sb->s_maxbytes)) + return 0; + init_sync_kiocb(&iocb, in); iocb.ki_pos = *ppos;