All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Alexei Starovoitov <ast@kernel.org>,
	Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: davem@davemloft.net, daniel@iogearbox.net, peterz@infradead.org,
	mhiramat@kernel.org, kuba@kernel.org, andrii@kernel.org,
	netdev@vger.kernel.org, bpf@vger.kernel.org, kernel-team@fb.com
Subject: [PATCH bpf] rethook: Fix to use WRITE_ONCE() for rethook::handler
Date: Thu, 31 Mar 2022 10:11:17 +0900	[thread overview]
Message-ID: <164868907688.21983.1606862921419988152.stgit@devnote2> (raw)
In-Reply-To: <CAADnVQJvzYn3Yw4-exrvUUTFijq0yEJruLkxfzutEgJUVtUj3g@mail.gmail.com>

Since the function pointered by rethook::handler never be removed when
the rethook is alive, it doesn't need to use rcu_assign_pointer() to
update it. Just use WRITE_ONCE().

Reported-by: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 kernel/trace/rethook.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/rethook.c b/kernel/trace/rethook.c
index ab463a4d2b23..b56833700d23 100644
--- a/kernel/trace/rethook.c
+++ b/kernel/trace/rethook.c
@@ -65,7 +65,7 @@ static void rethook_free_rcu(struct rcu_head *head)
  */
 void rethook_free(struct rethook *rh)
 {
-	rcu_assign_pointer(rh->handler, NULL);
+	WRITE_ONCE(rh->handler, NULL);
 
 	call_rcu(&rh->rcu, rethook_free_rcu);
 }


  reply	other threads:[~2022-03-31  1:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-29 23:49 pull-request: bpf 2022-03-29 Alexei Starovoitov
2022-03-30  1:41 ` Jakub Kicinski
2022-03-30  1:51   ` Alexei Starovoitov
2022-03-30  2:02     ` Jakub Kicinski
2022-03-30  4:52     ` Masami Hiramatsu
2022-03-30  9:15       ` Masami Hiramatsu
2022-03-30 15:09         ` Alexei Starovoitov
2022-03-31  1:11           ` Masami Hiramatsu [this message]
2022-03-31  2:30             ` [PATCH bpf] rethook: Fix to use WRITE_ONCE() for rethook::handler patchwork-bot+netdevbpf
2022-03-31  1:12           ` pull-request: bpf 2022-03-29 Masami Hiramatsu
2022-03-30  8:05     ` Jiri Olsa
2022-03-30 11:01       ` Jiri Olsa
2022-03-30  4:10 ` patchwork-bot+netdevbpf

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=164868907688.21983.1606862921419988152.stgit@devnote2 \
    --to=mhiramat@kernel.org \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=kernel-team@fb.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=peterz@infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.