diff options
author | Prasanna S Panchamukhi <prasanna@in.ibm.com> | 2005-05-05 19:15:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-05-05 19:36:39 -0400 |
commit | 04dea5f93231204cc3ca0ab793ce76dbb10c86ba (patch) | |
tree | b47e20371a62b46bedea4337f191d245b44b097f /kernel/kprobes.c | |
parent | 0b9e2cac8a56e197d0a9e06268db4c8652d23dd5 (diff) |
[PATCH] Kprobes: Oops! in unregister_kprobe()
kernel oops! when unregister_kprobe() is called on a non-registered
kprobe. This patch fixes the above problem by checking if the probe exists
before unregistering.
Signed-off-by: Prasanna S Panchamukhi <prasanna@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/kprobes.c')
-rw-r--r-- | kernel/kprobes.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 1d5dd1337bd1..d8903e60c99a 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c | |||
@@ -107,13 +107,17 @@ rm_kprobe: | |||
107 | void unregister_kprobe(struct kprobe *p) | 107 | void unregister_kprobe(struct kprobe *p) |
108 | { | 108 | { |
109 | unsigned long flags; | 109 | unsigned long flags; |
110 | arch_remove_kprobe(p); | ||
111 | spin_lock_irqsave(&kprobe_lock, flags); | 110 | spin_lock_irqsave(&kprobe_lock, flags); |
111 | if (!get_kprobe(p->addr)) { | ||
112 | spin_unlock_irqrestore(&kprobe_lock, flags); | ||
113 | return; | ||
114 | } | ||
112 | *p->addr = p->opcode; | 115 | *p->addr = p->opcode; |
113 | hlist_del(&p->hlist); | 116 | hlist_del(&p->hlist); |
114 | flush_icache_range((unsigned long) p->addr, | 117 | flush_icache_range((unsigned long) p->addr, |
115 | (unsigned long) p->addr + sizeof(kprobe_opcode_t)); | 118 | (unsigned long) p->addr + sizeof(kprobe_opcode_t)); |
116 | spin_unlock_irqrestore(&kprobe_lock, flags); | 119 | spin_unlock_irqrestore(&kprobe_lock, flags); |
120 | arch_remove_kprobe(p); | ||
117 | } | 121 | } |
118 | 122 | ||
119 | static struct notifier_block kprobe_exceptions_nb = { | 123 | static struct notifier_block kprobe_exceptions_nb = { |