diff mbox series

[bpf] rethook: Fix to use WRITE_ONCE() for rethook::handler

Message ID 164868907688.21983.1606862921419988152.stgit@devnote2 (mailing list archive)
State Accepted
Commit a2fb49833cad07a53651c23dce508127085fae2d
Delegated to: BPF
Headers show
Series [bpf] rethook: Fix to use WRITE_ONCE() for rethook::handler | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for bpf
netdev/fixes_present fail Series targets non-next tree, but doesn't contain any Fixes tags
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 3 this patch: 2
netdev/cc_maintainers warning 7 maintainers not CCed: rostedt@goodmis.org songliubraving@fb.com kafai@fb.com yhs@fb.com mingo@redhat.com john.fastabend@gmail.com kpsingh@kernel.org
netdev/build_clang success Errors and warnings before: 9 this patch: 9
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 3 this patch: 2
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
bpf/vmtest-bpf-PR fail PR summary

Commit Message

Masami Hiramatsu (Google) March 31, 2022, 1:11 a.m. UTC
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(-)

Comments

patchwork-bot+netdevbpf@kernel.org March 31, 2022, 2:30 a.m. UTC | #1
Hello:

This patch was applied to bpf/bpf.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Thu, 31 Mar 2022 10:11:17 +0900 you wrote:
> 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>
> 
> [...]

Here is the summary with links:
  - [bpf] rethook: Fix to use WRITE_ONCE() for rethook::handler
    https://git.kernel.org/bpf/bpf/c/a2fb49833cad

You are awesome, thank you!
diff mbox series

Patch

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);
 }