aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 60d2644bfe85..8c859eef8e6a 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -18,7 +18,7 @@
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/vmalloc.h> 19#include <linux/vmalloc.h>
20#include <linux/completion.h> 20#include <linux/completion.h>
21#include <linux/namespace.h> 21#include <linux/mnt_namespace.h>
22#include <linux/personality.h> 22#include <linux/personality.h>
23#include <linux/mempolicy.h> 23#include <linux/mempolicy.h>
24#include <linux/sem.h> 24#include <linux/sem.h>
@@ -1525,17 +1525,18 @@ static int unshare_fs(unsigned long unshare_flags, struct fs_struct **new_fsp)
1525} 1525}
1526 1526
1527/* 1527/*
1528 * Unshare the namespace structure if it is being shared 1528 * Unshare the mnt_namespace structure if it is being shared
1529 */ 1529 */
1530static int unshare_namespace(unsigned long unshare_flags, struct namespace **new_nsp, struct fs_struct *new_fs) 1530static int unshare_mnt_namespace(unsigned long unshare_flags,
1531 struct mnt_namespace **new_nsp, struct fs_struct *new_fs)
1531{ 1532{
1532 struct namespace *ns = current->nsproxy->namespace; 1533 struct mnt_namespace *ns = current->nsproxy->mnt_ns;
1533 1534
1534 if ((unshare_flags & CLONE_NEWNS) && ns) { 1535 if ((unshare_flags & CLONE_NEWNS) && ns) {
1535 if (!capable(CAP_SYS_ADMIN)) 1536 if (!capable(CAP_SYS_ADMIN))
1536 return -EPERM; 1537 return -EPERM;
1537 1538
1538 *new_nsp = dup_namespace(current, new_fs ? new_fs : current->fs); 1539 *new_nsp = dup_mnt_ns(current, new_fs ? new_fs : current->fs);
1539 if (!*new_nsp) 1540 if (!*new_nsp)
1540 return -ENOMEM; 1541 return -ENOMEM;
1541 } 1542 }
@@ -1623,7 +1624,7 @@ asmlinkage long sys_unshare(unsigned long unshare_flags)
1623{ 1624{
1624 int err = 0; 1625 int err = 0;
1625 struct fs_struct *fs, *new_fs = NULL; 1626 struct fs_struct *fs, *new_fs = NULL;
1626 struct namespace *ns, *new_ns = NULL; 1627 struct mnt_namespace *ns, *new_ns = NULL;
1627 struct sighand_struct *new_sigh = NULL; 1628 struct sighand_struct *new_sigh = NULL;
1628 struct mm_struct *mm, *new_mm = NULL, *active_mm = NULL; 1629 struct mm_struct *mm, *new_mm = NULL, *active_mm = NULL;
1629 struct files_struct *fd, *new_fd = NULL; 1630 struct files_struct *fd, *new_fd = NULL;
@@ -1645,7 +1646,7 @@ asmlinkage long sys_unshare(unsigned long unshare_flags)
1645 goto bad_unshare_out; 1646 goto bad_unshare_out;
1646 if ((err = unshare_fs(unshare_flags, &new_fs))) 1647 if ((err = unshare_fs(unshare_flags, &new_fs)))
1647 goto bad_unshare_cleanup_thread; 1648 goto bad_unshare_cleanup_thread;
1648 if ((err = unshare_namespace(unshare_flags, &new_ns, new_fs))) 1649 if ((err = unshare_mnt_namespace(unshare_flags, &new_ns, new_fs)))
1649 goto bad_unshare_cleanup_fs; 1650 goto bad_unshare_cleanup_fs;
1650 if ((err = unshare_sighand(unshare_flags, &new_sigh))) 1651 if ((err = unshare_sighand(unshare_flags, &new_sigh)))
1651 goto bad_unshare_cleanup_ns; 1652 goto bad_unshare_cleanup_ns;
@@ -1686,8 +1687,8 @@ asmlinkage long sys_unshare(unsigned long unshare_flags)
1686 } 1687 }
1687 1688
1688 if (new_ns) { 1689 if (new_ns) {
1689 ns = current->nsproxy->namespace; 1690 ns = current->nsproxy->mnt_ns;
1690 current->nsproxy->namespace = new_ns; 1691 current->nsproxy->mnt_ns = new_ns;
1691 new_ns = ns; 1692 new_ns = ns;
1692 } 1693 }
1693 1694
@@ -1748,7 +1749,7 @@ bad_unshare_cleanup_sigh:
1748 1749
1749bad_unshare_cleanup_ns: 1750bad_unshare_cleanup_ns:
1750 if (new_ns) 1751 if (new_ns)
1751 put_namespace(new_ns); 1752 put_mnt_ns(new_ns);
1752 1753
1753bad_unshare_cleanup_fs: 1754bad_unshare_cleanup_fs:
1754 if (new_fs) 1755 if (new_fs)