diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2008-02-08 07:19:16 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-08 12:22:28 -0500 |
commit | 69440e76f6121fe7a5193a82f45ccec08e4bb24b (patch) | |
tree | 1a573c55bbcb8d8d83f7a21551ca08c6ac35dfe8 /arch/mips/kernel/irixsig.c | |
parent | ac9a8e3f0f43d20fc316162e8e5f9186d295ff49 (diff) |
pid: fix mips irix emulation pid usage
[m.kozlowski@tuxland.pl: fix unbalanced parenthesis in irix_BSDsetpgrp()]
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Cc: Pavel Emelyanov <xemul@openvz.org>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/mips/kernel/irixsig.c')
-rw-r--r-- | arch/mips/kernel/irixsig.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/arch/mips/kernel/irixsig.c b/arch/mips/kernel/irixsig.c index 5b10ac133ec8..0215c805a592 100644 --- a/arch/mips/kernel/irixsig.c +++ b/arch/mips/kernel/irixsig.c | |||
@@ -578,10 +578,11 @@ out: | |||
578 | 578 | ||
579 | #define W_MASK (W_EXITED | W_TRAPPED | W_STOPPED | W_CONT | W_NOHANG) | 579 | #define W_MASK (W_EXITED | W_TRAPPED | W_STOPPED | W_CONT | W_NOHANG) |
580 | 580 | ||
581 | asmlinkage int irix_waitsys(int type, int pid, | 581 | asmlinkage int irix_waitsys(int type, int upid, |
582 | struct irix5_siginfo __user *info, int options, | 582 | struct irix5_siginfo __user *info, int options, |
583 | struct rusage __user *ru) | 583 | struct rusage __user *ru) |
584 | { | 584 | { |
585 | struct pid *pid = NULL; | ||
585 | int flag, retval; | 586 | int flag, retval; |
586 | DECLARE_WAITQUEUE(wait, current); | 587 | DECLARE_WAITQUEUE(wait, current); |
587 | struct task_struct *tsk; | 588 | struct task_struct *tsk; |
@@ -604,6 +605,8 @@ asmlinkage int irix_waitsys(int type, int pid, | |||
604 | if (type != IRIX_P_PID && type != IRIX_P_PGID && type != IRIX_P_ALL) | 605 | if (type != IRIX_P_PID && type != IRIX_P_PGID && type != IRIX_P_ALL) |
605 | return -EINVAL; | 606 | return -EINVAL; |
606 | 607 | ||
608 | if (type != IRIX_P_ALL) | ||
609 | pid = find_get_pid(upid); | ||
607 | add_wait_queue(¤t->signal->wait_chldexit, &wait); | 610 | add_wait_queue(¤t->signal->wait_chldexit, &wait); |
608 | repeat: | 611 | repeat: |
609 | flag = 0; | 612 | flag = 0; |
@@ -612,9 +615,9 @@ repeat: | |||
612 | tsk = current; | 615 | tsk = current; |
613 | list_for_each(_p, &tsk->children) { | 616 | list_for_each(_p, &tsk->children) { |
614 | p = list_entry(_p, struct task_struct, sibling); | 617 | p = list_entry(_p, struct task_struct, sibling); |
615 | if ((type == IRIX_P_PID) && p->pid != pid) | 618 | if ((type == IRIX_P_PID) && task_pid(p) != pid) |
616 | continue; | 619 | continue; |
617 | if ((type == IRIX_P_PGID) && task_pgrp_nr(p) != pid) | 620 | if ((type == IRIX_P_PGID) && task_pgrp(p) != pid) |
618 | continue; | 621 | continue; |
619 | if ((p->exit_signal != SIGCHLD)) | 622 | if ((p->exit_signal != SIGCHLD)) |
620 | continue; | 623 | continue; |
@@ -639,7 +642,7 @@ repeat: | |||
639 | 642 | ||
640 | retval = __put_user(SIGCHLD, &info->sig); | 643 | retval = __put_user(SIGCHLD, &info->sig); |
641 | retval |= __put_user(0, &info->code); | 644 | retval |= __put_user(0, &info->code); |
642 | retval |= __put_user(p->pid, &info->stuff.procinfo.pid); | 645 | retval |= __put_user(task_pid_vnr(p), &info->stuff.procinfo.pid); |
643 | retval |= __put_user((p->exit_code >> 8) & 0xff, | 646 | retval |= __put_user((p->exit_code >> 8) & 0xff, |
644 | &info->stuff.procinfo.procdata.child.status); | 647 | &info->stuff.procinfo.procdata.child.status); |
645 | retval |= __put_user(p->utime, &info->stuff.procinfo.procdata.child.utime); | 648 | retval |= __put_user(p->utime, &info->stuff.procinfo.procdata.child.utime); |
@@ -657,7 +660,7 @@ repeat: | |||
657 | getrusage(p, RUSAGE_BOTH, ru); | 660 | getrusage(p, RUSAGE_BOTH, ru); |
658 | retval = __put_user(SIGCHLD, &info->sig); | 661 | retval = __put_user(SIGCHLD, &info->sig); |
659 | retval |= __put_user(1, &info->code); /* CLD_EXITED */ | 662 | retval |= __put_user(1, &info->code); /* CLD_EXITED */ |
660 | retval |= __put_user(p->pid, &info->stuff.procinfo.pid); | 663 | retval |= __put_user(task_pid_vnr(p), &info->stuff.procinfo.pid); |
661 | retval |= __put_user((p->exit_code >> 8) & 0xff, | 664 | retval |= __put_user((p->exit_code >> 8) & 0xff, |
662 | &info->stuff.procinfo.procdata.child.status); | 665 | &info->stuff.procinfo.procdata.child.status); |
663 | retval |= __put_user(p->utime, | 666 | retval |= __put_user(p->utime, |
@@ -665,7 +668,7 @@ repeat: | |||
665 | retval |= __put_user(p->stime, | 668 | retval |= __put_user(p->stime, |
666 | &info->stuff.procinfo.procdata.child.stime); | 669 | &info->stuff.procinfo.procdata.child.stime); |
667 | if (retval) | 670 | if (retval) |
668 | return retval; | 671 | goto end_waitsys; |
669 | 672 | ||
670 | if (p->real_parent != p->parent) { | 673 | if (p->real_parent != p->parent) { |
671 | write_lock_irq(&tasklist_lock); | 674 | write_lock_irq(&tasklist_lock); |
@@ -698,6 +701,7 @@ repeat: | |||
698 | end_waitsys: | 701 | end_waitsys: |
699 | current->state = TASK_RUNNING; | 702 | current->state = TASK_RUNNING; |
700 | remove_wait_queue(¤t->signal->wait_chldexit, &wait); | 703 | remove_wait_queue(¤t->signal->wait_chldexit, &wait); |
704 | put_pid(pid); | ||
701 | 705 | ||
702 | return retval; | 706 | return retval; |
703 | } | 707 | } |