Skip to content

Commit

Permalink
rethook: Fix to use WRITE_ONCE() for rethook:: Handler
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mhiramat authored and Alexei Starovoitov committed Mar 31, 2022
1 parent 2609f63 commit a2fb498
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/trace/rethook.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit a2fb498

Please sign in to comment.