Skip to content

Commit

Permalink
uprobes: Do not leak UTASK_BP_HIT if find_active_uprobe() fails
Browse files Browse the repository at this point in the history
If handle_swbp()->find_active_uprobe() fails we return with
utask->state = UTASK_BP_HIT.

Change handle_swbp() to reset utask->state at the start. Note
that we do this unconditionally, see the next patch(es).

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
  • Loading branch information
Oleg Nesterov committed Sep 29, 2012
1 parent 1d787d3 commit 79d54b2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion kernel/events/uprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -1468,6 +1468,10 @@ static void handle_swbp(struct pt_regs *regs)
bp_vaddr = uprobe_get_swbp_addr(regs);
uprobe = find_active_uprobe(bp_vaddr, &is_swbp);

utask = current->utask;
if (utask)
utask->state = UTASK_RUNNING;

if (!uprobe) {
if (is_swbp > 0) {
/* No matching uprobe; signal SIGTRAP. */
Expand All @@ -1486,7 +1490,6 @@ static void handle_swbp(struct pt_regs *regs)
return;
}

utask = current->utask;
if (!utask) {
utask = add_utask();
/* Cannot allocate; re-execute the instruction. */
Expand Down

0 comments on commit 79d54b2

Please sign in to comment.