|
@@ -669,6 +669,10 @@ remove_breakpoint(struct uprobe *uprobe, struct mm_struct *mm, unsigned long vad
|
|
|
return set_orig_insn(&uprobe->arch, mm, vaddr);
|
|
|
}
|
|
|
|
|
|
+static inline bool uprobe_is_active(struct uprobe *uprobe)
|
|
|
+{
|
|
|
+ return !RB_EMPTY_NODE(&uprobe->rb_node);
|
|
|
+}
|
|
|
/*
|
|
|
* There could be threads that have already hit the breakpoint. They
|
|
|
* will recheck the current insn and restart if find_uprobe() fails.
|
|
@@ -676,9 +680,13 @@ remove_breakpoint(struct uprobe *uprobe, struct mm_struct *mm, unsigned long vad
|
|
|
*/
|
|
|
static void delete_uprobe(struct uprobe *uprobe)
|
|
|
{
|
|
|
+ if (WARN_ON(!uprobe_is_active(uprobe)))
|
|
|
+ return;
|
|
|
+
|
|
|
spin_lock(&uprobes_treelock);
|
|
|
rb_erase(&uprobe->rb_node, &uprobes_tree);
|
|
|
spin_unlock(&uprobes_treelock);
|
|
|
+ RB_CLEAR_NODE(&uprobe->rb_node); /* for uprobe_is_active() */
|
|
|
iput(uprobe->inode);
|
|
|
put_uprobe(uprobe);
|
|
|
}
|