aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/exec.c8
-rw-r--r--include/linux/sched.h1
-rw-r--r--kernel/fork.c17
3 files changed, 13 insertions, 13 deletions
diff --git a/fs/exec.c b/fs/exec.c
index 92ce83a11e90..dccdcec913e9 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1915,7 +1915,6 @@ static int coredump_wait(int exit_code, struct core_state *core_state)
1915{ 1915{
1916 struct task_struct *tsk = current; 1916 struct task_struct *tsk = current;
1917 struct mm_struct *mm = tsk->mm; 1917 struct mm_struct *mm = tsk->mm;
1918 struct completion *vfork_done;
1919 int core_waiters = -EBUSY; 1918 int core_waiters = -EBUSY;
1920 1919
1921 init_completion(&core_state->startup); 1920 init_completion(&core_state->startup);
@@ -1934,11 +1933,8 @@ static int coredump_wait(int exit_code, struct core_state *core_state)
1934 * Make sure nobody is waiting for us to release the VM, 1933 * Make sure nobody is waiting for us to release the VM,
1935 * otherwise we can deadlock when we wait on each other 1934 * otherwise we can deadlock when we wait on each other
1936 */ 1935 */
1937 vfork_done = tsk->vfork_done; 1936 if (tsk->vfork_done)
1938 if (vfork_done) { 1937 complete_vfork_done(tsk);
1939 tsk->vfork_done = NULL;
1940 complete(vfork_done);
1941 }
1942 1938
1943 if (core_waiters) 1939 if (core_waiters)
1944 wait_for_completion(&core_state->startup); 1940 wait_for_completion(&core_state->startup);
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 7d379a6bfd88..1b25a37f2aee 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2291,6 +2291,7 @@ extern int do_execve(const char *,
2291 const char __user * const __user *, 2291 const char __user * const __user *,
2292 const char __user * const __user *, struct pt_regs *); 2292 const char __user * const __user *, struct pt_regs *);
2293extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *); 2293extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *);
2294extern void complete_vfork_done(struct task_struct *tsk);
2294struct task_struct *fork_idle(int); 2295struct task_struct *fork_idle(int);
2295 2296
2296extern void set_task_comm(struct task_struct *tsk, char *from); 2297extern void set_task_comm(struct task_struct *tsk, char *from);
diff --git a/kernel/fork.c b/kernel/fork.c
index e2cd3e2a5ae8..cf3d96379608 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -668,6 +668,14 @@ struct mm_struct *mm_access(struct task_struct *task, unsigned int mode)
668 return mm; 668 return mm;
669} 669}
670 670
671void complete_vfork_done(struct task_struct *tsk)
672{
673 struct completion *vfork_done = tsk->vfork_done;
674
675 tsk->vfork_done = NULL;
676 complete(vfork_done);
677}
678
671/* Please note the differences between mmput and mm_release. 679/* Please note the differences between mmput and mm_release.
672 * mmput is called whenever we stop holding onto a mm_struct, 680 * mmput is called whenever we stop holding onto a mm_struct,
673 * error success whatever. 681 * error success whatever.
@@ -683,8 +691,6 @@ struct mm_struct *mm_access(struct task_struct *task, unsigned int mode)
683 */ 691 */
684void mm_release(struct task_struct *tsk, struct mm_struct *mm) 692void mm_release(struct task_struct *tsk, struct mm_struct *mm)
685{ 693{
686 struct completion *vfork_done = tsk->vfork_done;
687
688 /* Get rid of any futexes when releasing the mm */ 694 /* Get rid of any futexes when releasing the mm */
689#ifdef CONFIG_FUTEX 695#ifdef CONFIG_FUTEX
690 if (unlikely(tsk->robust_list)) { 696 if (unlikely(tsk->robust_list)) {
@@ -704,11 +710,8 @@ void mm_release(struct task_struct *tsk, struct mm_struct *mm)
704 /* Get rid of any cached register state */ 710 /* Get rid of any cached register state */
705 deactivate_mm(tsk, mm); 711 deactivate_mm(tsk, mm);
706 712
707 /* notify parent sleeping on vfork() */ 713 if (tsk->vfork_done)
708 if (vfork_done) { 714 complete_vfork_done(tsk);
709 tsk->vfork_done = NULL;
710 complete(vfork_done);
711 }
712 715
713 /* 716 /*
714 * If we're exiting normally, clear a user-space tid field if 717 * If we're exiting normally, clear a user-space tid field if