Skip to content

Commit 9da79ab

Browse files
srikardacmel
authored andcommitted
tracing/kprobes: unregister_trace_probe needs to be called under mutex
Comment in unregister_trace_probe() says probe_lock will be held when it gets called. However there is a case where it might called without the probe_lock being held. Also since we are traversing the probe_list and deleting an element from the probe_list, probe_lock should be held. This was first pointed in uprobes traceevent review by Frederic Weisbecker here. (http://lkml.org/lkml/2010/5/12/106) Cc: Ingo Molnar <mingo@elte.hu> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Acked-by: Steven Rostedt <rostedt@goodmis.org> LKML-Reference: <20100630084548.GA10325@linux.vnet.ibm.com> Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent b83f920 commit 9da79ab

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎kernel/trace/trace_kprobe.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -925,14 +925,17 @@ static int create_trace_probe(int argc, char **argv)
925925
pr_info("Delete command needs an event name.\n");
926926
return -EINVAL;
927927
}
928+
mutex_lock(&probe_lock);
928929
tp = find_probe_event(event, group);
929930
if (!tp) {
931+
mutex_unlock(&probe_lock);
930932
pr_info("Event %s/%s doesn't exist.\n", group, event);
931933
return -ENOENT;
932934
}
933935
/* delete an event */
934936
unregister_trace_probe(tp);
935937
free_trace_probe(tp);
938+
mutex_unlock(&probe_lock);
936939
return 0;
937940
}
938941

0 commit comments

Comments
 (0)