linux/fs/fuse
Joanne Koong 7c18691e0c fuse: re-lock request before replacing page cache folio
[ Upstream commit a078484921 ]

fuse_try_move_folio() unlocks the request on entry but does not
re-lock it on the success path. This means fuse_chan_abort() can end the
request and free the fuse_io_args (eg fuse_readpages_end()) while the
subsequent copy chain logic after fuse_try_move_folio() accesses the
fuse_io_args, leading to use-after-free issues.

Fix this by calling lock_request() before replace_page_cache_folio().
This ensures the request is locked on the success path which will
prevent the fuse_io_args from being freed while the later copying logic
runs, and also ensures that the ap->folios[i]->mapping is never null
since ap->folios[i] will always point to the newfolio after
replace_page_cache_folio().

Fixes: ce534fb052 ("fuse: allow splice to move pages")
Cc: stable@vger.kernel.org
Reported-by: Lei Lu <llfamsec@gmail.com>
Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2026-07-04 13:39:41 +02:00
..
acl.c vfs: add rcu argument to ->get_acl() callback 2021-08-18 22:08:24 +02:00
control.c fuse: quiet down complaints in fuse_conn_limit_write 2026-06-01 17:35:12 +02:00
cuse.c fuse: fix UAF in rcu pathwalks 2024-09-04 13:23:23 +02:00
dax.c fuse: fix dax truncate/punch_hole fault path 2025-04-10 14:32:02 +02:00
dev.c fuse: re-lock request before replacing page cache folio 2026-07-04 13:39:41 +02:00
dir.c fuse: allocate ff->release_args only if release is needed 2025-10-29 14:03:14 +01:00
file.c virtiofs: fix UAF on submount umount 2026-07-04 13:39:37 +02:00
fuse_i.h fuse: allocate ff->release_args only if release is needed 2025-10-29 14:03:14 +01:00
inode.c fuse: fix UAF in rcu pathwalks 2024-09-04 13:23:23 +02:00
ioctl.c use less confusing names for iov_iter direction initializers 2026-06-19 13:33:46 +02:00
Kconfig virtiofs: implement dax read/write operations 2020-09-10 11:39:23 +02:00
Makefile fuse: move ioctl to separate source file 2021-04-12 15:04:30 +02:00
readdir.c fuse: reject oversized dirents in page cache 2026-06-01 17:35:12 +02:00
virtio_fs.c virtiofs: add filesystem context source name check 2025-05-02 07:44:14 +02:00
xattr.c fuse: use unsigned type for getxattr/listxattr size truncation 2024-09-12 11:07:44 +02:00