public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH v2 1/4] io_uring: zero ref_node after killing it
Date: Sat, 20 Feb 2021 18:03:47 +0000	[thread overview]
Message-ID: <611ab369e6aab4d4008a4e41e17a53d44c5d7c04.1613844023.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>

After a rsrc/files reference node's refs are killed, it must never be
used. And that's how it works, it either assigns a new node or kills the
whole data table.

Let's explicitly NULL it, that shouldn't be necessary, but if something
would go wrong I'd rather catch a NULL dereference to using a dangling
pointer.

Signed-off-by: Pavel Begunkov <[email protected]>
---
 fs/io_uring.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index b7bae301744b..50d4dba08f82 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -7335,6 +7335,7 @@ static void io_sqe_rsrc_kill_node(struct io_ring_ctx *ctx, struct fixed_rsrc_dat
 
 	io_rsrc_ref_lock(ctx);
 	ref_node = data->node;
+	data->node = NULL;
 	io_rsrc_ref_unlock(ctx);
 	if (ref_node)
 		percpu_ref_kill(&ref_node->refs);
-- 
2.24.0


  reply	other threads:[~2021-02-20 18:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-20 18:03 [PATCH v2 0/4] rsrc quiesce fixes/hardening v2 Pavel Begunkov
2021-02-20 18:03 ` Pavel Begunkov [this message]
2021-02-20 18:03 ` [PATCH v2 2/4] io_uring: fix io_rsrc_ref_quiesce races Pavel Begunkov
2021-02-20 18:03 ` [PATCH v2 3/4] io_uring: keep generic rsrc infra generic Pavel Begunkov
2021-02-20 18:03 ` [PATCH v2 4/4] io_uring: wait potential ->release() on resurrect Pavel Begunkov
2021-02-20 18:33 ` [PATCH v2 0/4] rsrc quiesce fixes/hardening v2 Jens Axboe
2021-02-21 13:22 ` Hao Xu
2021-02-22 14:05   ` Pavel Begunkov

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=611ab369e6aab4d4008a4e41e17a53d44c5d7c04.1613844023.git.asml.silence@gmail.com \
    [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