aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2006-12-08 05:36:09 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-08 11:28:38 -0500
commitdae3c5a0b7052ad7dd9fa78c51ecfab828c5007b (patch)
treefea5f0ac63b3b14641593e0c38634829719ff95c /kernel
parentae424ae4b5bcd820ad6ee6f0b986c4e14ed4d6cf (diff)
[PATCH] sys_unshare: remove a broken CLONE_SIGHAND code
sys_unshare(CLONE_SIGHAND) is broken, the code under 'if (new_sigh)' is never executed but very wrong. Just remove it to avoid a confusion, task_lock() has nothing to do with ->sighand changing. Also, change the comment in unshare_sighand(). Yes, CLONE_THREAD implies CLONE_SIGHAND, but still it looks confusing. Also, we don't need to check current->sighand != NULL. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/fork.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 7f2e31ba33af..f387a1393ca5 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1544,15 +1544,13 @@ static int unshare_namespace(unsigned long unshare_flags, struct namespace **new
1544} 1544}
1545 1545
1546/* 1546/*
1547 * Unsharing of sighand for tasks created with CLONE_SIGHAND is not 1547 * Unsharing of sighand is not supported yet
1548 * supported yet
1549 */ 1548 */
1550static int unshare_sighand(unsigned long unshare_flags, struct sighand_struct **new_sighp) 1549static int unshare_sighand(unsigned long unshare_flags, struct sighand_struct **new_sighp)
1551{ 1550{
1552 struct sighand_struct *sigh = current->sighand; 1551 struct sighand_struct *sigh = current->sighand;
1553 1552
1554 if ((unshare_flags & CLONE_SIGHAND) && 1553 if ((unshare_flags & CLONE_SIGHAND) && atomic_read(&sigh->count) > 1)
1555 (sigh && atomic_read(&sigh->count) > 1))
1556 return -EINVAL; 1554 return -EINVAL;
1557 else 1555 else
1558 return 0; 1556 return 0;
@@ -1626,7 +1624,7 @@ asmlinkage long sys_unshare(unsigned long unshare_flags)
1626 int err = 0; 1624 int err = 0;
1627 struct fs_struct *fs, *new_fs = NULL; 1625 struct fs_struct *fs, *new_fs = NULL;
1628 struct namespace *ns, *new_ns = NULL; 1626 struct namespace *ns, *new_ns = NULL;
1629 struct sighand_struct *sigh, *new_sigh = NULL; 1627 struct sighand_struct *new_sigh = NULL;
1630 struct mm_struct *mm, *new_mm = NULL, *active_mm = NULL; 1628 struct mm_struct *mm, *new_mm = NULL, *active_mm = NULL;
1631 struct files_struct *fd, *new_fd = NULL; 1629 struct files_struct *fd, *new_fd = NULL;
1632 struct sem_undo_list *new_ulist = NULL; 1630 struct sem_undo_list *new_ulist = NULL;
@@ -1671,7 +1669,7 @@ asmlinkage long sys_unshare(unsigned long unshare_flags)
1671 } 1669 }
1672 } 1670 }
1673 1671
1674 if (new_fs || new_ns || new_sigh || new_mm || new_fd || new_ulist || 1672 if (new_fs || new_ns || new_mm || new_fd || new_ulist ||
1675 new_uts || new_ipc) { 1673 new_uts || new_ipc) {
1676 1674
1677 task_lock(current); 1675 task_lock(current);
@@ -1693,12 +1691,6 @@ asmlinkage long sys_unshare(unsigned long unshare_flags)
1693 new_ns = ns; 1691 new_ns = ns;
1694 } 1692 }
1695 1693
1696 if (new_sigh) {
1697 sigh = current->sighand;
1698 rcu_assign_pointer(current->sighand, new_sigh);
1699 new_sigh = sigh;
1700 }
1701
1702 if (new_mm) { 1694 if (new_mm) {
1703 mm = current->mm; 1695 mm = current->mm;
1704 active_mm = current->active_mm; 1696 active_mm = current->active_mm;