From: Darrick J. Wong Date: Mon, 29 Oct 2018 23:40:39 +0000 (+1100) Subject: vfs: exit early from zero length remap operations X-Git-Tag: v4.20-rc1~23^2~25 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2c5773f102c9bb07d5328467f61f0a88f2f2892d;p=thirdparty%2Fkernel%2Flinux.git vfs: exit early from zero length remap operations If a remap caller asks us to remap to the source file's EOF and the source file length leaves us with a zero byte request, exit early. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Signed-off-by: Dave Chinner --- diff --git a/fs/read_write.c b/fs/read_write.c index d6e8e242a15fa..2456da3f8a414 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -1748,6 +1748,8 @@ int vfs_clone_file_prep(struct file *file_in, loff_t pos_in, if (pos_in > isize) return -EINVAL; *len = isize - pos_in; + if (*len == 0) + return 0; } /* Check that we don't violate system file offset limits. */