[PATCH] Don't oops when unregistering unknown kprobes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Prasanna,

Here's a patch that handles gracefully attempts to unregister
unregistered kprobes (ie. a warning message instead of an oops).
Patch is against 2.6.12-rc3

Signed-off-by: Frederik Deweerdt <[email protected]>

Regards,
Frederik

-- 
o----------------------------------------------o
| http://open-news.net : l'info alternative    |
| Tech - Sciences - Politique - International  |
o----------------------------------------------o
--- linux-2.6.12-rc3/kernel/kprobes.c	2005-04-26 16:35:22.000000000 +0200
+++ linux-2.6.12-rc3-devel/kernel/kprobes.c	2005-04-26 16:44:57.000000000 +0200
@@ -107,6 +107,13 @@ rm_kprobe:
 void unregister_kprobe(struct kprobe *p)
 {
 	unsigned long flags;
+
+	if (!get_kprobe(p)) {
+		printk(KERN_WARNING "Warning: Attempt to unregister "
+					"unknown kprobe (addr:0x%lx)\n",
+					(unsigned long) p);
+		return;
+	}
 	arch_remove_kprobe(p);
 	spin_lock_irqsave(&kprobe_lock, flags);
 	*p->addr = p->opcode;

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux