mirror-linux/fs/fuse
Junxi Qian c3880a7b10
fuse: fix writeback array overflow when max_pages is one
fuse_iomap_writeback_range() appends one folio pointer and one
fuse_folio_desc for every dirty range that is merged into the current
writeback request.  The merge decision checks the byte budget against
fc->max_pages and fc->max_write, but it does not check whether the folio
and descriptor arrays still have another free slot.

This is not sufficient for fuseblk, where the filesystem block size can
be smaller than PAGE_SIZE.  With writeback cache enabled and max_pages
negotiated as one, contiguous sub-page dirty ranges can fit within the
byte budget while spanning more than one folio.  The next append can then
write past the one-slot folios and descs arrays.

Split the request when the number of already attached folios has reached
fc->max_pages.  This keeps the folio/descriptor slot accounting in sync
with the send decision.

Fixes: ef7e7cbb32 ("fuse: use iomap for writeback")
Cc: stable@vger.kernel.org
Reviewed-by: Joanne Koong <joannelkoong@gmail.com>
Signed-off-by: Junxi Qian <qjx1298677004@gmail.com>
Link: https://patch.msgid.link/20260506122415.205340-1-qjx1298677004@gmail.com
Acked-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
2026-05-11 14:19:01 +02:00
..
Kconfig fuse: fix references to fuse.rst -> fuse/fuse.rst 2025-09-02 11:14:15 +02:00
Makefile fuse: move CREATE_TRACE_POINTS to a separate file 2025-09-25 16:22:18 +02:00
acl.c posix_acl: make posix_acl_to_xattr() alloc the buffer 2026-01-16 10:51:12 +01:00
backing.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
control.c fuse: quiet down complaints in fuse_conn_limit_write 2026-03-03 10:05:39 +01:00
cuse.c fuse: add refcount to fuse_dev 2026-04-02 20:43:24 +02:00
dax.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
dev.c fuse: clean up device cloning 2026-04-02 20:52:59 +02:00
dev_uring.c fuse: refactor duplicate queue teardown operation 2026-02-27 15:16:34 +01:00
dev_uring_i.h fuse: add kernel-enforced timeout option for requests 2025-03-31 14:59:25 +02:00
dir.c fuse: fix uninit-value in fuse_dentry_revalidate() 2026-03-03 17:43:34 +01:00
file.c fuse: fix writeback array overflow when max_pages is one 2026-05-11 14:19:01 +02:00
fuse_dev_i.h fuse: add refcount to fuse_dev 2026-04-02 20:43:24 +02:00
fuse_i.h fuse: clean up device cloning 2026-04-02 20:52:59 +02:00
fuse_trace.h fuse: add simple request tracepoints 2024-08-29 11:43:13 +02:00
inode.c fuse update for 7.1 2026-04-15 19:04:21 -07:00
ioctl.c Revert "fs: make vfs_fileattr_[get|set] return -EOPNOTSUPP" 2025-10-10 13:44:03 +02:00
iomode.c fuse: remove unused 'inode' parameter in fuse_passthrough_open 2025-08-27 14:29:44 +02:00
passthrough.c lsm: add backing_file LSM hooks 2026-04-03 16:53:50 -04:00
readdir.c vfs-7.1-rc1.fixes 2026-04-23 17:08:04 -07:00
sysctl.c fuse: add default_request_timeout and max_request_timeout sysctls 2025-03-31 14:59:27 +02:00
trace.c fuse: move CREATE_TRACE_POINTS to a separate file 2025-09-25 16:22:18 +02:00
virtio_fs.c fuse: add refcount to fuse_dev 2026-04-02 20:43:24 +02:00
xattr.c fuse: make args->in_args[0] to be always the header 2025-01-24 11:54:02 +01:00