commit b6f63cc1d2f7b8d690835c965d600fda47ffd79b Author: Bernd Schubert Date: Mon May 18 13:30:30 2026 +0200 fuse: Avoid use-after-free in fuse_uring_async_stop_queues fuse_uring_async_stop_queues() might run when the last reference on ring->queue_refs was already dropped. In order to avoid an early destruction a reference on struct fuse_conn is now taken before starting fuse_uring_async_stop_queues() and that reference is only released when that delayed work queue terminates. Fixes: 4a9bfb9b6850 ("fuse: {io-uring} Handle teardown of ring entries") Cc: stable@kernel.org # 6.14 Reported-by: Berkant Koc Signed-off-by: Bernd Schubert diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index e467b23e6895..c96d72250830 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -465,7 +465,10 @@ static void fuse_uring_async_stop_queues(struct work_struct *work) schedule_delayed_work(&ring->async_teardown_work, FUSE_URING_TEARDOWN_INTERVAL); } else { + struct fuse_chan *chan = ring->chan; + wake_up_all(&ring->stop_waitq); + fuse_conn_put(chan->conn); } } @@ -477,6 +480,9 @@ void fuse_uring_stop_queues(struct fuse_ring *ring) fuse_uring_teardown_all_queues(ring); if (atomic_read(&ring->queue_refs) > 0) { + struct fuse_chan *chan = ring->chan; + + fuse_conn_get(chan->conn); ring->teardown_time = jiffies; INIT_DELAYED_WORK(&ring->async_teardown_work, fuse_uring_async_stop_queues);