diff options
-rw-r--r-- | kernel/exit.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index b55ed4cc9104..92369240d91d 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -1033,6 +1033,8 @@ asmlinkage void sys_exit_group(int error_code) | |||
1033 | 1033 | ||
1034 | static int eligible_child(pid_t pid, int options, struct task_struct *p) | 1034 | static int eligible_child(pid_t pid, int options, struct task_struct *p) |
1035 | { | 1035 | { |
1036 | int err; | ||
1037 | |||
1036 | if (pid > 0) { | 1038 | if (pid > 0) { |
1037 | if (p->pid != pid) | 1039 | if (p->pid != pid) |
1038 | return 0; | 1040 | return 0; |
@@ -1066,8 +1068,9 @@ static int eligible_child(pid_t pid, int options, struct task_struct *p) | |||
1066 | if (delay_group_leader(p)) | 1068 | if (delay_group_leader(p)) |
1067 | return 2; | 1069 | return 2; |
1068 | 1070 | ||
1069 | if (security_task_wait(p)) | 1071 | err = security_task_wait(p); |
1070 | return 0; | 1072 | if (err) |
1073 | return err; | ||
1071 | 1074 | ||
1072 | return 1; | 1075 | return 1; |
1073 | } | 1076 | } |
@@ -1449,6 +1452,7 @@ static long do_wait(pid_t pid, int options, struct siginfo __user *infop, | |||
1449 | DECLARE_WAITQUEUE(wait, current); | 1452 | DECLARE_WAITQUEUE(wait, current); |
1450 | struct task_struct *tsk; | 1453 | struct task_struct *tsk; |
1451 | int flag, retval; | 1454 | int flag, retval; |
1455 | int allowed, denied; | ||
1452 | 1456 | ||
1453 | add_wait_queue(¤t->signal->wait_chldexit,&wait); | 1457 | add_wait_queue(¤t->signal->wait_chldexit,&wait); |
1454 | repeat: | 1458 | repeat: |
@@ -1457,6 +1461,7 @@ repeat: | |||
1457 | * match our criteria, even if we are not able to reap it yet. | 1461 | * match our criteria, even if we are not able to reap it yet. |
1458 | */ | 1462 | */ |
1459 | flag = 0; | 1463 | flag = 0; |
1464 | allowed = denied = 0; | ||
1460 | current->state = TASK_INTERRUPTIBLE; | 1465 | current->state = TASK_INTERRUPTIBLE; |
1461 | read_lock(&tasklist_lock); | 1466 | read_lock(&tasklist_lock); |
1462 | tsk = current; | 1467 | tsk = current; |
@@ -1472,6 +1477,12 @@ repeat: | |||
1472 | if (!ret) | 1477 | if (!ret) |
1473 | continue; | 1478 | continue; |
1474 | 1479 | ||
1480 | if (unlikely(ret < 0)) { | ||
1481 | denied = ret; | ||
1482 | continue; | ||
1483 | } | ||
1484 | allowed = 1; | ||
1485 | |||
1475 | switch (p->state) { | 1486 | switch (p->state) { |
1476 | case TASK_TRACED: | 1487 | case TASK_TRACED: |
1477 | /* | 1488 | /* |
@@ -1570,6 +1581,8 @@ check_continued: | |||
1570 | goto repeat; | 1581 | goto repeat; |
1571 | } | 1582 | } |
1572 | retval = -ECHILD; | 1583 | retval = -ECHILD; |
1584 | if (unlikely(denied) && !allowed) | ||
1585 | retval = denied; | ||
1573 | end: | 1586 | end: |
1574 | current->state = TASK_RUNNING; | 1587 | current->state = TASK_RUNNING; |
1575 | remove_wait_queue(¤t->signal->wait_chldexit,&wait); | 1588 | remove_wait_queue(¤t->signal->wait_chldexit,&wait); |