Skip to content

Commit c4cd906

Browse files
committed
io_uring/rw: fix downgraded mshot read
JIRA: https://issues.redhat.com/browse/RHEL-105612 commit 38fc96a Author: Pavel Begunkov <asml.silence@gmail.com> Date: Sat Dec 28 17:44:52 2024 +0000 io_uring/rw: fix downgraded mshot read The io-wq path can downgrade a multishot request to oneshot mode, however io_read_mshot() doesn't handle that and would still post multiple CQEs. That's not allowed, because io_req_post_cqe() requires stricter context requirements. The described can only happen with pollable files that don't support FMODE_NOWAIT, which is an odd combination, so if even allowed it should be fairly rare. Cc: stable@vger.kernel.org Reported-by: chase xd <sl1589472800@gmail.com> Fixes: bee1d5b ("io_uring: disable io-wq execution of multishot NOWAIT requests") Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/c5c8c4a50a882fd581257b81bf52eee260ac29fd.1735407848.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
1 parent f1c85fb commit c4cd906

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

io_uring/rw.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,8 @@ int io_read_mshot(struct io_kiocb *req, unsigned int issue_flags)
984984
io_kbuf_recycle(req, issue_flags);
985985
if (ret < 0)
986986
req_set_fail(req);
987+
} else if (!(req->flags & REQ_F_APOLL_MULTISHOT)) {
988+
cflags = io_put_kbuf(req, ret, issue_flags);
987989
} else {
988990
/*
989991
* Any successful return value will keep the multishot read

0 commit comments

Comments
 (0)