]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
fuse: prevent overflow in copy_file_range return value
authorMiklos Szeredi <mszeredi@redhat.com>
Tue, 12 Aug 2025 12:46:34 +0000 (14:46 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 19 Sep 2025 14:29:57 +0000 (16:29 +0200)
commitc079916d889b6c3e53112889a9be9ff06ffa328b
treebf1db2039c92fc1b697da9f0bef495d41de88e4d
parentd7300080c0c4f29d14f740352ea0ea3cc7a76596
fuse: prevent overflow in copy_file_range return value

commit 1e08938c3694f707bb165535df352ac97a8c75c9 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 <fweimer@redhat.com>
Closes: https://lore.kernel.org/all/lhuh5ynl8z5.fsf@oldenburg.str.redhat.com/
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>
fs/fuse/file.c