mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 13:53:33 +00:00
io_uring/poll: don't reissue in case of poll race on multishot request
commit8caa03f10b
upstream. A previous commit fixed a poll race that can occur, but it's only applicable for multishot requests. For a multishot request, we can safely ignore a spurious wakeup, as we never leave the waitqueue to begin with. A blunt reissue of a multishot armed request can cause us to leak a buffer, if they are ring provided. While this seems like a bug in itself, it's not really defined behavior to reissue a multishot request directly. It's less efficient to do so as well, and not required to rearm anything like it is for singleshot poll requests. Cc: stable@vger.kernel.org Fixes:6e5aedb932
("io_uring/poll: attempt request issue after racy poll wakeup") Reported-and-tested-by: Olivier Langlois <olivier@trillion01.com> Link: https://github.com/axboe/liburing/issues/778 Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
66144d830f
commit
36fc7317cd
1 changed files with 5 additions and 1 deletions
|
@ -281,8 +281,12 @@ static int io_poll_check_events(struct io_kiocb *req, bool *locked)
|
|||
* to the waitqueue, so if we get nothing back, we
|
||||
* should be safe and attempt a reissue.
|
||||
*/
|
||||
if (unlikely(!req->cqe.res))
|
||||
if (unlikely(!req->cqe.res)) {
|
||||
/* Multishot armed need not reissue */
|
||||
if (!(req->apoll_events & EPOLLONESHOT))
|
||||
continue;
|
||||
return IOU_POLL_REISSUE;
|
||||
}
|
||||
}
|
||||
if (req->apoll_events & EPOLLONESHOT)
|
||||
return IOU_POLL_DONE;
|
||||
|
|
Loading…
Reference in a new issue