Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 37834
b: refs/heads/master
c: c0b2fc3
h: refs/heads/master
v: v3
  • Loading branch information
Serge Hallyn authored and Linus Torvalds committed Oct 2, 2006
1 parent 07bb94b commit 771269c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 071df104f808b8195c40643dcb4d060681742e29
refs/heads/master: c0b2fc316599d6cd875b6b8cafa67f03b9512b4d
20 changes: 14 additions & 6 deletions trunk/kernel/fork.c
Original file line number Diff line number Diff line change
Expand Up @@ -1606,7 +1606,7 @@ asmlinkage long sys_unshare(unsigned long unshare_flags)
struct mm_struct *mm, *new_mm = NULL, *active_mm = NULL;
struct files_struct *fd, *new_fd = NULL;
struct sem_undo_list *new_ulist = NULL;
struct nsproxy *new_nsproxy, *old_nsproxy;
struct nsproxy *new_nsproxy = NULL, *old_nsproxy = NULL;
struct uts_namespace *uts, *new_uts = NULL;

check_unshare_flags(&unshare_flags);
Expand Down Expand Up @@ -1634,18 +1634,24 @@ asmlinkage long sys_unshare(unsigned long unshare_flags)
if ((err = unshare_utsname(unshare_flags, &new_uts)))
goto bad_unshare_cleanup_semundo;

if (new_fs || new_ns || new_sigh || new_mm || new_fd || new_ulist ||
new_uts) {

if (new_ns || new_uts) {
old_nsproxy = current->nsproxy;
new_nsproxy = dup_namespaces(old_nsproxy);
if (!new_nsproxy) {
err = -ENOMEM;
goto bad_unshare_cleanup_uts;
}
}

if (new_fs || new_ns || new_sigh || new_mm || new_fd || new_ulist ||
new_uts) {

task_lock(current);
current->nsproxy = new_nsproxy;

if (new_nsproxy) {
current->nsproxy = new_nsproxy;
new_nsproxy = old_nsproxy;
}

if (new_fs) {
fs = current->fs;
Expand Down Expand Up @@ -1687,9 +1693,11 @@ asmlinkage long sys_unshare(unsigned long unshare_flags)
}

task_unlock(current);
put_nsproxy(old_nsproxy);
}

if (new_nsproxy)
put_nsproxy(new_nsproxy);

bad_unshare_cleanup_uts:
if (new_uts)
put_uts_ns(new_uts);
Expand Down

0 comments on commit 771269c

Please sign in to comment.