Skip to content

Commit

Permalink
ptrace: remove silly wait_trap variable from ptrace_attach()
Browse files Browse the repository at this point in the history
Remove local variable wait_trap which determines whether to wait for
!TRAPPING or not and simply wait for it if attach was successful.

-v2: Oleg pointed out wait should happen iff attach was successful.

Signed-off-by: Tejun Heo <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Signed-off-by: Oleg Nesterov <[email protected]>
  • Loading branch information
htejun authored and oleg-nesterov committed Jun 4, 2011
1 parent 23c79d3 commit 0b1007c
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ bool ptrace_may_access(struct task_struct *task, unsigned int mode)

static int ptrace_attach(struct task_struct *task)
{
bool wait_trap = false;
int retval;

audit_ptrace(task);
Expand Down Expand Up @@ -246,7 +245,6 @@ static int ptrace_attach(struct task_struct *task)
if (task_is_stopped(task)) {
task->group_stop |= GROUP_STOP_PENDING | GROUP_STOP_TRAPPING;
signal_wake_up(task, 1);
wait_trap = true;
}

spin_unlock(&task->sighand->siglock);
Expand All @@ -257,7 +255,7 @@ static int ptrace_attach(struct task_struct *task)
unlock_creds:
mutex_unlock(&task->signal->cred_guard_mutex);
out:
if (wait_trap)
if (!retval)
wait_event(current->signal->wait_chldexit,
!(task->group_stop & GROUP_STOP_TRAPPING));
return retval;
Expand Down

0 comments on commit 0b1007c

Please sign in to comment.