Skip to content

Commit 07db298

Browse files
isilenceaxboe
authored andcommitted
io_uring: safer sq_creds putting
Put sq_creds as a part of io_ring_ctx_free(), it's easy to miss doing it in io_sq_thread_finish(), especially considering past mistakes related to ring creation failures. Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/3becb1866467a1de82a97345a0a90d7fb8ff875e.1618916549.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
1 parent 3a0a690 commit 07db298

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/io_uring.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7229,8 +7229,6 @@ static void io_sq_thread_finish(struct io_ring_ctx *ctx)
72297229

72307230
io_put_sq_data(sqd);
72317231
ctx->sq_data = NULL;
7232-
if (ctx->sq_creds)
7233-
put_cred(ctx->sq_creds);
72347232
}
72357233
}
72367234

@@ -8425,6 +8423,8 @@ static void io_ring_ctx_free(struct io_ring_ctx *ctx)
84258423
mutex_unlock(&ctx->uring_lock);
84268424
io_eventfd_unregister(ctx);
84278425
io_destroy_buffers(ctx);
8426+
if (ctx->sq_creds)
8427+
put_cred(ctx->sq_creds);
84288428

84298429
/* there are no registered resources left, nobody uses it */
84308430
if (ctx->rsrc_node)

0 commit comments

Comments
 (0)