diff options
author | Jens Axboe <axboe@kernel.dk> | 2023-06-16 21:12:06 -0600 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-06-21 15:45:37 +0200 |
commit | 4716c73b188566865bdd79c3a6709696a224ac04 (patch) | |
tree | bfbf2562ee4147cdb58f31e11b63b98fb256c20a /io_uring | |
parent | 93a68acc497bf59d523761ae40f348ded413c744 (diff) | |
download | linux-stable-4716c73b188566865bdd79c3a6709696a224ac04.tar.gz linux-stable-4716c73b188566865bdd79c3a6709696a224ac04.tar.bz2 linux-stable-4716c73b188566865bdd79c3a6709696a224ac04.zip |
io_uring: hold uring mutex around poll removal
Snipped from commit 9ca9fb24d5febccea354089c41f96a8ad0d853f8 upstream.
While reworking the poll hashing in the v6.0 kernel, we ended up
grabbing the ctx->uring_lock in poll update/removal. This also fixed
a bug with linked timeouts racing with timeout expiry and poll
removal.
Bring back just the locking fix for that.
Reported-and-tested-by: Querijn Voet <querijnqyn@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/io_uring.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index fd799567fc23..58e063114398 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -5966,6 +5966,8 @@ static int io_poll_update(struct io_kiocb *req, unsigned int issue_flags) struct io_kiocb *preq; int ret2, ret = 0; + io_ring_submit_lock(ctx, !(issue_flags & IO_URING_F_NONBLOCK)); + spin_lock(&ctx->completion_lock); preq = io_poll_find(ctx, req->poll_update.old_user_data, true); if (!preq || !io_poll_disarm(preq)) { @@ -5997,6 +5999,7 @@ out: req_set_fail(req); /* complete update request, we're done with it */ io_req_complete(req, ret); + io_ring_submit_unlock(ctx, !(issue_flags & IO_URING_F_NONBLOCK)); return 0; } |