Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8d632766 authored by Miklos Szeredi's avatar Miklos Szeredi Committed by Greg Kroah-Hartman
Browse files

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: default avatarChunsheng Luo <luochunsheng@ustc.edu>
Closes: https://lore.kernel.org/all/20250807062425.694-1-luochunsheng@ustc.edu/


Fixes: 88bc7d50 ("fuse: add support for copy_file_range()")
Cc: <stable@vger.kernel.org> # v4.20
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 18630c36
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -3365,6 +3365,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;