aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exec.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2008-07-25 04:47:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-25 13:53:40 -0400
commit9d5b327bf198d2720666de958dcc2ae219d86952 (patch)
tree2eba6fe178581c2291393a061ff42d09da95386b /fs/exec.c
parentc5f1cc8c1828486a61ab3e575da6e2c62b34d399 (diff)
coredump: make mm->core_state visible to ->core_dump()
Move the "struct core_state core_state" from coredump_wait() to do_coredump(), this makes mm->core_state visible to binfmt->core_dump(). Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Acked-by: Roland McGrath <roland@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/exec.c')
-rw-r--r--fs/exec.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/exec.c b/fs/exec.c
index 15d493fe8aa3..b8ee842d93cd 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1595,17 +1595,16 @@ done:
1595 return nr; 1595 return nr;
1596} 1596}
1597 1597
1598static int coredump_wait(int exit_code) 1598static int coredump_wait(int exit_code, struct core_state *core_state)
1599{ 1599{
1600 struct task_struct *tsk = current; 1600 struct task_struct *tsk = current;
1601 struct mm_struct *mm = tsk->mm; 1601 struct mm_struct *mm = tsk->mm;
1602 struct core_state core_state;
1603 struct completion *vfork_done; 1602 struct completion *vfork_done;
1604 int core_waiters; 1603 int core_waiters;
1605 1604
1606 init_completion(&mm->core_done); 1605 init_completion(&mm->core_done);
1607 init_completion(&core_state.startup); 1606 init_completion(&core_state->startup);
1608 core_waiters = zap_threads(tsk, mm, &core_state, exit_code); 1607 core_waiters = zap_threads(tsk, mm, core_state, exit_code);
1609 up_write(&mm->mmap_sem); 1608 up_write(&mm->mmap_sem);
1610 1609
1611 if (unlikely(core_waiters < 0)) 1610 if (unlikely(core_waiters < 0))
@@ -1622,8 +1621,7 @@ static int coredump_wait(int exit_code)
1622 } 1621 }
1623 1622
1624 if (core_waiters) 1623 if (core_waiters)
1625 wait_for_completion(&core_state.startup); 1624 wait_for_completion(&core_state->startup);
1626 mm->core_state = NULL;
1627fail: 1625fail:
1628 return core_waiters; 1626 return core_waiters;
1629} 1627}
@@ -1679,6 +1677,7 @@ int get_dumpable(struct mm_struct *mm)
1679 1677
1680int do_coredump(long signr, int exit_code, struct pt_regs * regs) 1678int do_coredump(long signr, int exit_code, struct pt_regs * regs)
1681{ 1679{
1680 struct core_state core_state;
1682 char corename[CORENAME_MAX_SIZE + 1]; 1681 char corename[CORENAME_MAX_SIZE + 1];
1683 struct mm_struct *mm = current->mm; 1682 struct mm_struct *mm = current->mm;
1684 struct linux_binfmt * binfmt; 1683 struct linux_binfmt * binfmt;
@@ -1717,7 +1716,7 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
1717 current->fsuid = 0; /* Dump root private */ 1716 current->fsuid = 0; /* Dump root private */
1718 } 1717 }
1719 1718
1720 retval = coredump_wait(exit_code); 1719 retval = coredump_wait(exit_code, &core_state);
1721 if (retval < 0) 1720 if (retval < 0)
1722 goto fail; 1721 goto fail;
1723 1722
@@ -1812,6 +1811,7 @@ fail_unlock:
1812 1811
1813 current->fsuid = fsuid; 1812 current->fsuid = fsuid;
1814 complete_all(&mm->core_done); 1813 complete_all(&mm->core_done);
1814 mm->core_state = NULL;
1815fail: 1815fail:
1816 return retval; 1816 return retval;
1817} 1817}