public inbox for [email protected]
 help / color / mirror / Atom feed
From: Usama Arif <[email protected]>
To: [email protected], [email protected],
	[email protected], [email protected]
Cc: [email protected], [email protected], [email protected],
	Usama Arif <[email protected]>,
	kernel test robot <[email protected]>
Subject: [PATCH] io_uring: unregister eventfd while holding lock when freeing ring ctx
Date: Mon,  7 Feb 2022 10:50:40 +0000	[thread overview]
Message-ID: <[email protected]> (raw)

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


             reply	other threads:[~2022-02-07 10:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-07 10:50 Usama Arif [this message]
2022-02-07 13:46 ` [PATCH] io_uring: unregister eventfd while holding lock when freeing ring ctx Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox