Skip to content

Commit 532b876

Browse files
Miklos Szeredigregkh
authored andcommitted
fuse: prevent overflow in copy_file_range return value
commit 1e08938 upstream. The FUSE protocol uses struct fuse_write_out to convey the return value of copy_file_range, which is restricted to uint32_t. But the COPY_FILE_RANGE interface supports a 64-bit size copies. Currently the number of bytes copied is silently truncated to 32-bit, which may result in poor performance or even failure to copy in case of truncation to zero. Reported-by: Florian Weimer <[email protected]> Closes: https://lore.kernel.org/all/[email protected]/ Fixes: 88bc7d5 ("fuse: add support for copy_file_range()") Cc: <[email protected]> # v4.20 Signed-off-by: Miklos Szeredi <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b7c40f0 commit 532b876

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/fuse/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3229,7 +3229,7 @@ static ssize_t __fuse_copy_file_range(struct file *file_in, loff_t pos_in,
32293229
.nodeid_out = ff_out->nodeid,
32303230
.fh_out = ff_out->fh,
32313231
.off_out = pos_out,
3232-
.len = len,
3232+
.len = min_t(size_t, len, UINT_MAX & PAGE_MASK),
32333233
.flags = flags
32343234
};
32353235
struct fuse_write_out outarg;

0 commit comments

Comments
 (0)