aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 2deaf481efab..d2f4a420a5b9 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1632,7 +1632,7 @@ asmlinkage long sys_unshare(unsigned long unshare_flags)
1632 struct mm_struct *mm, *new_mm = NULL, *active_mm = NULL; 1632 struct mm_struct *mm, *new_mm = NULL, *active_mm = NULL;
1633 struct files_struct *fd, *new_fd = NULL; 1633 struct files_struct *fd, *new_fd = NULL;
1634 struct sem_undo_list *new_ulist = NULL; 1634 struct sem_undo_list *new_ulist = NULL;
1635 struct nsproxy *new_nsproxy = NULL, *old_nsproxy = NULL; 1635 struct nsproxy *new_nsproxy = NULL;
1636 1636
1637 check_unshare_flags(&unshare_flags); 1637 check_unshare_flags(&unshare_flags);
1638 1638
@@ -1662,14 +1662,13 @@ asmlinkage long sys_unshare(unsigned long unshare_flags)
1662 1662
1663 if (new_fs || new_mm || new_fd || new_ulist || new_nsproxy) { 1663 if (new_fs || new_mm || new_fd || new_ulist || new_nsproxy) {
1664 1664
1665 task_lock(current);
1666
1667 if (new_nsproxy) { 1665 if (new_nsproxy) {
1668 old_nsproxy = current->nsproxy; 1666 switch_task_namespaces(current, new_nsproxy);
1669 current->nsproxy = new_nsproxy; 1667 new_nsproxy = NULL;
1670 new_nsproxy = old_nsproxy;
1671 } 1668 }
1672 1669
1670 task_lock(current);
1671
1673 if (new_fs) { 1672 if (new_fs) {
1674 fs = current->fs; 1673 fs = current->fs;
1675 current->fs = new_fs; 1674 current->fs = new_fs;