提交 04dea5f9 编写于 作者: P Prasanna S Panchamukhi 提交者: Linus Torvalds

[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: NPrasanna S Panchamukhi <prasanna@in.ibm.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 0b9e2cac
......@@ -107,13 +107,17 @@ int register_kprobe(struct kprobe *p)
void unregister_kprobe(struct kprobe *p)
{
unsigned long flags;
arch_remove_kprobe(p);
spin_lock_irqsave(&kprobe_lock, flags);
if (!get_kprobe(p->addr)) {
spin_unlock_irqrestore(&kprobe_lock, flags);
return;
}
*p->addr = p->opcode;
hlist_del(&p->hlist);
flush_icache_range((unsigned long) p->addr,
(unsigned long) p->addr + sizeof(kprobe_opcode_t));
spin_unlock_irqrestore(&kprobe_lock, flags);
arch_remove_kprobe(p);
}
static struct notifier_block kprobe_exceptions_nb = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册