Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rethook: Fix to use WRITE_ONCE() for rethook:: Handler

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>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/164868907688.21983.1606862921419988152.stgit@devnote2

authored by

Masami Hiramatsu and committed by
Alexei Starovoitov
a2fb4983 2609f635

+1 -1
+1 -1
kernel/trace/rethook.c
··· 65 65 */ 66 66 void rethook_free(struct rethook *rh) 67 67 { 68 - rcu_assign_pointer(rh->handler, NULL); 68 + WRITE_ONCE(rh->handler, NULL); 69 69 70 70 call_rcu(&rh->rcu, rethook_free_rcu); 71 71 }