public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] io_uring: unregister eventfd while holding lock when freeing ring ctx
@ 2022-02-07 10:50 Usama Arif
  2022-02-07 13:46 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Usama Arif @ 2022-02-07 10:50 UTC (permalink / raw)
  To: io-uring, axboe, asml.silence, linux-kernel
  Cc: fam.zheng, lkp, lkp, Usama Arif, kernel test robot

This is because ctx->io_ev_fd is rcu_dereference_protected using
ctx->uring_lock in io_eventfd_unregister. Not locking the function
resulted in suspicious RCU usage reported by kernel test robot.

Reported-by: kernel test robot <[email protected]>
Signed-off-by: Usama Arif <[email protected]>
---
 fs/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index ad8f84376955..dbc9d3f3f6c5 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -9471,8 +9471,8 @@ static __cold void io_ring_ctx_free(struct io_ring_ctx *ctx)
 		__io_sqe_files_unregister(ctx);
 	if (ctx->rings)
 		__io_cqring_overflow_flush(ctx, true);
-	mutex_unlock(&ctx->uring_lock);
 	io_eventfd_unregister(ctx);
+	mutex_unlock(&ctx->uring_lock);
 	io_destroy_buffers(ctx);
 	if (ctx->sq_creds)
 		put_cred(ctx->sq_creds);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-07 14:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-07 10:50 [PATCH] io_uring: unregister eventfd while holding lock when freeing ring ctx Usama Arif
2022-02-07 13:46 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox