diff options
author | Srikar Dronamraju <srikar@linux.vnet.ibm.com> | 2010-06-30 04:45:48 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-08-04 11:41:23 -0400 |
commit | 9da79ab83ee33ddc1fdd0858fd3d70925a1bde99 (patch) | |
tree | 116f9d3c256a91ede964ebbfd3779949cc5953d4 /kernel/trace/trace_kprobe.c | |
parent | b83f920e179101a54721e5ab1d6c3edfb9d4bcbb (diff) |
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>
Diffstat (limited to 'kernel/trace/trace_kprobe.c')
-rw-r--r-- | kernel/trace/trace_kprobe.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index 1b79d1c15726..8b27c9849b42 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c | |||
@@ -925,14 +925,17 @@ static int create_trace_probe(int argc, char **argv) | |||
925 | pr_info("Delete command needs an event name.\n"); | 925 | pr_info("Delete command needs an event name.\n"); |
926 | return -EINVAL; | 926 | return -EINVAL; |
927 | } | 927 | } |
928 | mutex_lock(&probe_lock); | ||
928 | tp = find_probe_event(event, group); | 929 | tp = find_probe_event(event, group); |
929 | if (!tp) { | 930 | if (!tp) { |
931 | mutex_unlock(&probe_lock); | ||
930 | pr_info("Event %s/%s doesn't exist.\n", group, event); | 932 | pr_info("Event %s/%s doesn't exist.\n", group, event); |
931 | return -ENOENT; | 933 | return -ENOENT; |
932 | } | 934 | } |
933 | /* delete an event */ | 935 | /* delete an event */ |
934 | unregister_trace_probe(tp); | 936 | unregister_trace_probe(tp); |
935 | free_trace_probe(tp); | 937 | free_trace_probe(tp); |
938 | mutex_unlock(&probe_lock); | ||
936 | return 0; | 939 | return 0; |
937 | } | 940 | } |
938 | 941 | ||