Skip to content

Commit d730008

Browse files
Miklos Szeredigregkh
authored andcommitted
fuse: check if copy_file_range() returns larger than requested size
commit e520320 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e9874dc commit d730008

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fs/fuse/file.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3169,6 +3169,9 @@ static ssize_t __fuse_copy_file_range(struct file *file_in, loff_t pos_in,
31693169
fc->no_copy_file_range = 1;
31703170
err = -EOPNOTSUPP;
31713171
}
3172+
if (!err && outarg.size > len)
3173+
err = -EIO;
3174+
31723175
if (err)
31733176
goto out;
31743177

0 commit comments

Comments
 (0)