mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-22 16:06:04 -05:00
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: bee1d5becd
("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>
This commit is contained in:
parent
e33ac68e5e
commit
38fc96a58c
1 changed files with 2 additions and 0 deletions
|
@ -983,6 +983,8 @@ int io_read_mshot(struct io_kiocb *req, unsigned int issue_flags)
|
||||||
io_kbuf_recycle(req, issue_flags);
|
io_kbuf_recycle(req, issue_flags);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
req_set_fail(req);
|
req_set_fail(req);
|
||||||
|
} else if (!(req->flags & REQ_F_APOLL_MULTISHOT)) {
|
||||||
|
cflags = io_put_kbuf(req, ret, issue_flags);
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* Any successful return value will keep the multishot read
|
* Any successful return value will keep the multishot read
|
||||||
|
|
Loading…
Reference in a new issue