Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 54246
b: refs/heads/master
c: 7324328
h: refs/heads/master
v: v3
  • Loading branch information
Roland McGrath authored and Linus Torvalds committed May 7, 2007
1 parent 14ae9a3 commit f9311d4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 906e0be197232c219197d058ef5095baa7764cd4
refs/heads/master: 73243284463a761e04d69d22c7516b2be7de096c
17 changes: 15 additions & 2 deletions trunk/kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,8 @@ asmlinkage void sys_exit_group(int error_code)

static int eligible_child(pid_t pid, int options, struct task_struct *p)
{
int err;

if (pid > 0) {
if (p->pid != pid)
return 0;
Expand Down Expand Up @@ -1066,8 +1068,9 @@ static int eligible_child(pid_t pid, int options, struct task_struct *p)
if (delay_group_leader(p))
return 2;

if (security_task_wait(p))
return 0;
err = security_task_wait(p);
if (err)
return err;

return 1;
}
Expand Down Expand Up @@ -1449,6 +1452,7 @@ static long do_wait(pid_t pid, int options, struct siginfo __user *infop,
DECLARE_WAITQUEUE(wait, current);
struct task_struct *tsk;
int flag, retval;
int allowed, denied;

add_wait_queue(&current->signal->wait_chldexit,&wait);
repeat:
Expand All @@ -1457,6 +1461,7 @@ static long do_wait(pid_t pid, int options, struct siginfo __user *infop,
* match our criteria, even if we are not able to reap it yet.
*/
flag = 0;
allowed = denied = 0;
current->state = TASK_INTERRUPTIBLE;
read_lock(&tasklist_lock);
tsk = current;
Expand All @@ -1472,6 +1477,12 @@ static long do_wait(pid_t pid, int options, struct siginfo __user *infop,
if (!ret)
continue;

if (unlikely(ret < 0)) {
denied = ret;
continue;
}
allowed = 1;

switch (p->state) {
case TASK_TRACED:
/*
Expand Down Expand Up @@ -1570,6 +1581,8 @@ static long do_wait(pid_t pid, int options, struct siginfo __user *infop,
goto repeat;
}
retval = -ECHILD;
if (unlikely(denied) && !allowed)
retval = denied;
end:
current->state = TASK_RUNNING;
remove_wait_queue(&current->signal->wait_chldexit,&wait);
Expand Down

0 comments on commit f9311d4

Please sign in to comment.