Skip to content

Commit 7fdbc5f

Browse files
isilenceaxboe
authored andcommitted
io_uring: disallow self-propelled ring polling
When we post a CQE we wake all ring pollers as it normally should be. However, if a CQE was generated by a multishot poll request targeting its own ring, it'll wake that request up, which will make it to post a new CQE, which will wake the request and so on until it exhausts all CQ entries. Don't allow multishot polling io_uring files but downgrade them to oneshots, which was always stated as a correct behaviour that the userspace should check for. Cc: stable@vger.kernel.org Fixes: aa43477 ("io_uring: poll rework") Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/3124038c0e7474d427538c2d915335ec28c92d21.1668785722.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 100d6b1 commit 7fdbc5f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

io_uring/poll.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,8 @@ static int io_poll_check_events(struct io_kiocb *req, bool *locked)
246246
continue;
247247
if (req->apoll_events & EPOLLONESHOT)
248248
return IOU_POLL_DONE;
249+
if (io_is_uring_fops(req->file))
250+
return IOU_POLL_DONE;
249251

250252
/* multishot, just fill a CQE and proceed */
251253
if (!(req->flags & REQ_F_APOLL_MULTISHOT)) {

0 commit comments

Comments
 (0)