Commit 0b1007c3578569469a6fab6ae5cca918ccdc3ee1
Committed by
Oleg Nesterov
1 parent
23c79d31a3
Exists in
master
and in
4 other branches
ptrace: remove silly wait_trap variable from ptrace_attach()
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 <tj@kernel.org> Cc: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Showing 1 changed file with 1 additions and 3 deletions Side-by-side Diff
kernel/ptrace.c
... | ... | @@ -184,7 +184,6 @@ |
184 | 184 | |
185 | 185 | static int ptrace_attach(struct task_struct *task) |
186 | 186 | { |
187 | - bool wait_trap = false; | |
188 | 187 | int retval; |
189 | 188 | |
190 | 189 | audit_ptrace(task); |
... | ... | @@ -246,7 +245,6 @@ |
246 | 245 | if (task_is_stopped(task)) { |
247 | 246 | task->group_stop |= GROUP_STOP_PENDING | GROUP_STOP_TRAPPING; |
248 | 247 | signal_wake_up(task, 1); |
249 | - wait_trap = true; | |
250 | 248 | } |
251 | 249 | |
252 | 250 | spin_unlock(&task->sighand->siglock); |
... | ... | @@ -257,7 +255,7 @@ |
257 | 255 | unlock_creds: |
258 | 256 | mutex_unlock(&task->signal->cred_guard_mutex); |
259 | 257 | out: |
260 | - if (wait_trap) | |
258 | + if (!retval) | |
261 | 259 | wait_event(current->signal->wait_chldexit, |
262 | 260 | !(task->group_stop & GROUP_STOP_TRAPPING)); |
263 | 261 | return retval; |