diff options
| author | Miklos Szeredi <mszeredi@redhat.com> | 2025-08-12 14:07:54 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-10-02 13:39:01 +0200 |
| commit | 5d41589fa069993438ceb8df94ec63a0826776be (patch) | |
| tree | 172b414936c754a41748834d951ee366792c2373 /fs | |
| parent | b8af2e74e49dbab6e611e39d6125129e2e7883d4 (diff) | |
| download | linux-5d41589fa069993438ceb8df94ec63a0826776be.tar.gz linux-5d41589fa069993438ceb8df94ec63a0826776be.tar.bz2 linux-5d41589fa069993438ceb8df94ec63a0826776be.zip | |
fuse: check if copy_file_range() returns larger than requested size
commit e5203209b3935041dac541bc5b37efb44220cc0b 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: 88bc7d5097a1 ("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>
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/fuse/file.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 40fdb4dac5bb..9546484334cb 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -3113,6 +3113,9 @@ static ssize_t __fuse_copy_file_range(struct file *file_in, loff_t pos_in, fc->no_copy_file_range = 1; err = -EOPNOTSUPP; } + if (!err && outarg.size > len) + err = -EIO; + if (err) goto out; |
