Skip to content

Commit e520320

Browse files
author
Miklos Szeredi
committed
fuse: check if copy_file_range() returns larger than requested size
Just like write(), copy_file_range() should check if the return value is less or equal to the requested number of bytes. Reported-by: Chunsheng Luo <luochunsheng@ustc.edu> Closes: https://lore.kernel.org/all/20250807062425.694-1-luochunsheng@ustc.edu/ Fixes: 88bc7d5 ("fuse: add support for copy_file_range()") Cc: <stable@vger.kernel.org> # v4.20 Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
1 parent e9c8da6 commit e520320

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

fs/fuse/file.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3026,6 +3026,9 @@ static ssize_t __fuse_copy_file_range(struct file *file_in, loff_t pos_in,
30263026
fc->no_copy_file_range = 1;
30273027
err = -EOPNOTSUPP;
30283028
}
3029+
if (!err && outarg.size > len)
3030+
err = -EIO;
3031+
30293032
if (err)
30303033
goto out;
30313034

0 commit comments

Comments
 (0)