[FIX] synchronization in dbi_disarm_urp_inst_for_task() 68/19268/3
authorVasiliy Ulyanov <v.ulyanov@samsung.com>
Wed, 9 Apr 2014 14:13:09 +0000 (18:13 +0400)
committerVasiliy Ulyanov <v.ulyanov@samsung.com>
Wed, 9 Apr 2014 14:42:40 +0000 (18:42 +0400)
Change-Id: I5028441ac47280c4823d12c289734f4670881f3b
Signed-off-by: Vasiliy Ulyanov <v.ulyanov@samsung.com>
uprobe/swap_uprobes.c

index 4a43fad..e9257a4 100644 (file)
@@ -761,20 +761,25 @@ int dbi_register_uretprobe(struct uretprobe *rp)
        return 0;
 }
 
-/* Called with uretprobe_lock held */
 int dbi_disarm_urp_inst_for_task(struct task_struct *parent, struct task_struct *task)
 {
+       unsigned long flags;
        struct uretprobe_instance *ri;
-       struct hlist_head *head = uretprobe_inst_table_head(parent->mm);
+       struct hlist_head *head;
        struct hlist_node *tmp;
        DECLARE_NODE_PTR_FOR_HLIST(node);
 
+       spin_lock_irqsave(&uretprobe_lock, flags);
+
+       head = uretprobe_inst_table_head(parent->mm);
        swap_hlist_for_each_entry_safe(ri, node, tmp, head, hlist) {
                if (parent == ri->task) {
                        arch_disarm_urp_inst(ri, task);
                }
        }
 
+       spin_unlock_irqrestore(&uretprobe_lock, flags);
+
        return 0;
 }
 EXPORT_SYMBOL_GPL(dbi_disarm_urp_inst_for_task);