diff options
author | Oleg Nesterov <oleg@redhat.com> | 2012-08-08 11:35:08 -0400 |
---|---|---|
committer | Oleg Nesterov <oleg@redhat.com> | 2012-08-28 12:21:18 -0400 |
commit | 78f7411668aa0b2006d331f6a288416dd91b8e5d (patch) | |
tree | b48492a829701dce94ed098ad11b49663b072354 /kernel/events/uprobes.c | |
parent | 5e5be71ab3fd8bd2076606923791ece1634c199c (diff) |
uprobes: Do not use -EEXIST in install_breakpoint() paths
-EEXIST from install_breakpoint() no longer makes sense, all
callers should simply treat it as "success". Change the code
to return zero and simplify register_for_each_vma().
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Diffstat (limited to 'kernel/events/uprobes.c')
-rw-r--r-- | kernel/events/uprobes.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index 298fbbdf57e6..3e2996b809be 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c | |||
@@ -332,7 +332,7 @@ int __weak set_swbp(struct arch_uprobe *auprobe, struct mm_struct *mm, unsigned | |||
332 | */ | 332 | */ |
333 | result = is_swbp_at_addr(mm, vaddr); | 333 | result = is_swbp_at_addr(mm, vaddr); |
334 | if (result == 1) | 334 | if (result == 1) |
335 | return -EEXIST; | 335 | return 0; |
336 | 336 | ||
337 | if (result) | 337 | if (result) |
338 | return result; | 338 | return result; |
@@ -657,7 +657,7 @@ install_breakpoint(struct uprobe *uprobe, struct mm_struct *mm, | |||
657 | * Hence behave as if probe already existed. | 657 | * Hence behave as if probe already existed. |
658 | */ | 658 | */ |
659 | if (!uprobe->consumers) | 659 | if (!uprobe->consumers) |
660 | return -EEXIST; | 660 | return 0; |
661 | 661 | ||
662 | if (!(uprobe->flags & UPROBE_COPY_INSN)) { | 662 | if (!(uprobe->flags & UPROBE_COPY_INSN)) { |
663 | ret = copy_insn(uprobe, vma->vm_file); | 663 | ret = copy_insn(uprobe, vma->vm_file); |
@@ -817,17 +817,11 @@ static int register_for_each_vma(struct uprobe *uprobe, bool is_register) | |||
817 | vaddr_to_offset(vma, info->vaddr) != uprobe->offset) | 817 | vaddr_to_offset(vma, info->vaddr) != uprobe->offset) |
818 | goto unlock; | 818 | goto unlock; |
819 | 819 | ||
820 | if (is_register) { | 820 | if (is_register) |
821 | err = install_breakpoint(uprobe, mm, vma, info->vaddr); | 821 | err = install_breakpoint(uprobe, mm, vma, info->vaddr); |
822 | /* | 822 | else |
823 | * We can race against uprobe_mmap(), see the | ||
824 | * comment near uprobe_hash(). | ||
825 | */ | ||
826 | if (err == -EEXIST) | ||
827 | err = 0; | ||
828 | } else { | ||
829 | remove_breakpoint(uprobe, mm, info->vaddr); | 823 | remove_breakpoint(uprobe, mm, info->vaddr); |
830 | } | 824 | |
831 | unlock: | 825 | unlock: |
832 | up_write(&mm->mmap_sem); | 826 | up_write(&mm->mmap_sem); |
833 | free: | 827 | free: |