From: Usama Arif <usama.arif@bytedance.com>
To: io-uring@vger.kernel.org, axboe@kernel.dk,
asml.silence@gmail.com, linux-kernel@vger.kernel.org
Cc: fam.zheng@bytedance.com, lkp@lists.01.org, lkp@intel.com,
Usama Arif <usama.arif@bytedance.com>,
kernel test robot <oliver.sang@intel.com>
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: <20220207105040.2662467-1-usama.arif@bytedance.com> (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 <oliver.sang@intel.com>
Signed-off-by: Usama Arif <usama.arif@bytedance.com>
---
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
next reply other threads:[~2022-02-07 10:59 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 ` 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 \
--in-reply-to=20220207105040.2662467-1-usama.arif@bytedance.com \
--to=usama.arif@bytedance.com \
--cc=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=fam.zheng@bytedance.com \
--cc=io-uring@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=lkp@lists.01.org \
--cc=oliver.sang@intel.com \
/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
all inboxes | Powered by JetHome®