Skip to content

Commit cbdd96f

Browse files
mhiramatingomolnar
authored andcommitted
kprobes: Don't call BUG_ON() if there is a kprobe in use on free list
Instead of calling BUG_ON(), if we find a kprobe in use on free kprobe list, just remove it from the list and keep it on kprobe hash list as same as other in-use kprobes. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> Cc: David S . Miller <davem@davemloft.net> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Naveen N . Rao <naveen.n.rao@linux.vnet.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/153666126882.21306.10738207224288507996.stgit@devbox Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 819319f commit cbdd96f

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎kernel/kprobes.c‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,8 +546,14 @@ static void do_free_cleaned_kprobes(void)
546546
struct optimized_kprobe *op, *tmp;
547547

548548
list_for_each_entry_safe(op, tmp, &freeing_list, list) {
549-
BUG_ON(!kprobe_unused(&op->kp));
550549
list_del_init(&op->list);
550+
if (WARN_ON_ONCE(!kprobe_unused(&op->kp))) {
551+
/*
552+
* This must not happen, but if there is a kprobe
553+
* still in use, keep it on kprobes hash list.
554+
*/
555+
continue;
556+
}
551557
free_aggr_kprobe(&op->kp);
552558
}
553559
}

0 commit comments

Comments
 (0)