mirror of
https://gitee.com/openharmony/kernel_linux
synced 2025-02-03 16:43:42 +00:00
[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>
This commit is contained in:
parent
0b9e2cac8a
commit
04dea5f932
@ -107,13 +107,17 @@ rm_kprobe:
|
|||||||
void unregister_kprobe(struct kprobe *p)
|
void unregister_kprobe(struct kprobe *p)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
arch_remove_kprobe(p);
|
|
||||||
spin_lock_irqsave(&kprobe_lock, flags);
|
spin_lock_irqsave(&kprobe_lock, flags);
|
||||||
|
if (!get_kprobe(p->addr)) {
|
||||||
|
spin_unlock_irqrestore(&kprobe_lock, flags);
|
||||||
|
return;
|
||||||
|
}
|
||||||
*p->addr = p->opcode;
|
*p->addr = p->opcode;
|
||||||
hlist_del(&p->hlist);
|
hlist_del(&p->hlist);
|
||||||
flush_icache_range((unsigned long) p->addr,
|
flush_icache_range((unsigned long) p->addr,
|
||||||
(unsigned long) p->addr + sizeof(kprobe_opcode_t));
|
(unsigned long) p->addr + sizeof(kprobe_opcode_t));
|
||||||
spin_unlock_irqrestore(&kprobe_lock, flags);
|
spin_unlock_irqrestore(&kprobe_lock, flags);
|
||||||
|
arch_remove_kprobe(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct notifier_block kprobe_exceptions_nb = {
|
static struct notifier_block kprobe_exceptions_nb = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user