summaryrefslogtreecommitdiff
path: root/io_uring
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2025-01-28 00:55:24 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-02-17 11:36:52 +0100
commitf0ef94553868d07c1b14d7743a7e2553e5a831a3 (patch)
treee2e7644696c40918bc4298f2bf69d744796a8b68 /io_uring
parent398fa7ee50638d38fc4cb7204f0eebdf390eef78 (diff)
downloadlinux-f0ef94553868d07c1b14d7743a7e2553e5a831a3.tar.gz
linux-f0ef94553868d07c1b14d7743a7e2553e5a831a3.tar.bz2
linux-f0ef94553868d07c1b14d7743a7e2553e5a831a3.zip
io_uring: fix multishots with selected buffers
commit d63b0e8a628e62ca85a0f7915230186bb92f8bb4 upstream. We do io_kbuf_recycle() when arming a poll but every iteration of a multishot can grab more buffers, which is why we need to flush the kbuf ring state before continuing with waiting. Cc: stable@vger.kernel.org Fixes: b3fdea6ecb55c ("io_uring: multishot recv") Reported-by: Muhammad Ramdhan <ramdhan@starlabs.sg> Reported-by: Bing-Jhong Billy Jheng <billy@starlabs.sg> Reported-by: Jacob Soo <jacob.soo@starlabs.sg> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/1bfc9990fe435f1fc6152ca9efeba5eb3e68339c.1738025570.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'io_uring')
-rw-r--r--io_uring/poll.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/io_uring/poll.c b/io_uring/poll.c
index bced9edd5233..77e11c196270 100644
--- a/io_uring/poll.c
+++ b/io_uring/poll.c
@@ -315,8 +315,10 @@ void io_poll_task_func(struct io_kiocb *req, struct io_tw_state *ts)
ret = io_poll_check_events(req, ts);
if (ret == IOU_POLL_NO_ACTION) {
+ io_kbuf_recycle(req, 0);
return;
} else if (ret == IOU_POLL_REQUEUE) {
+ io_kbuf_recycle(req, 0);
__io_poll_execute(req, 0);
return;
}