]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
io_uring: kill goto error handling in io_sqpoll_wait_sq()
authorJens Axboe <axboe@kernel.dk>
Wed, 16 Nov 2022 08:43:39 +0000 (09:43 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Nov 2022 08:57:20 +0000 (09:57 +0100)
Hunk extracted from commit 70aacfe66136809d7f080f89c492c278298719f4
upstream.

If the sqpoll thread has died, the out condition doesn't remove the
waiting task from the waitqueue. The goto and check are not needed, just
make it a break condition after setting the error value. That ensures
that we always remove ourselves from sqo_sq_wait waitqueue.

Reported-by: Xingyuan Mo <hdthky0@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/io_uring.c

index 05f360b66b07a3ffcc539d7d182d67ecabad6a16..d1cb1addea965f03caf47086824b7fad348a0fa5 100644 (file)
@@ -9038,7 +9038,7 @@ static int io_sqpoll_wait_sq(struct io_ring_ctx *ctx)
 
                if (unlikely(ctx->sqo_dead)) {
                        ret = -EOWNERDEAD;
-                       goto out;
+                       break;
                }
 
                if (!io_sqring_full(ctx))
@@ -9048,7 +9048,6 @@ static int io_sqpoll_wait_sq(struct io_ring_ctx *ctx)
        } while (!signal_pending(current));
 
        finish_wait(&ctx->sqo_sq_wait, &wait);
-out:
        return ret;
 }