aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index c535f33bbb9c..1766d324d5e3 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -413,7 +413,7 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
413 tmp->vm_next = tmp->vm_prev = NULL; 413 tmp->vm_next = tmp->vm_prev = NULL;
414 file = tmp->vm_file; 414 file = tmp->vm_file;
415 if (file) { 415 if (file) {
416 struct inode *inode = file->f_path.dentry->d_inode; 416 struct inode *inode = file_inode(file);
417 struct address_space *mapping = file->f_mapping; 417 struct address_space *mapping = file->f_mapping;
418 418
419 get_file(file); 419 get_file(file);
@@ -1141,6 +1141,9 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1141 if ((clone_flags & (CLONE_NEWNS|CLONE_FS)) == (CLONE_NEWNS|CLONE_FS)) 1141 if ((clone_flags & (CLONE_NEWNS|CLONE_FS)) == (CLONE_NEWNS|CLONE_FS))
1142 return ERR_PTR(-EINVAL); 1142 return ERR_PTR(-EINVAL);
1143 1143
1144 if ((clone_flags & (CLONE_NEWUSER|CLONE_FS)) == (CLONE_NEWUSER|CLONE_FS))
1145 return ERR_PTR(-EINVAL);
1146
1144 /* 1147 /*
1145 * Thread groups must share signals as well, and detached threads 1148 * Thread groups must share signals as well, and detached threads
1146 * can only be started up within the thread group. 1149 * can only be started up within the thread group.
@@ -1233,6 +1236,12 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1233#ifndef CONFIG_VIRT_CPU_ACCOUNTING 1236#ifndef CONFIG_VIRT_CPU_ACCOUNTING
1234 p->prev_cputime.utime = p->prev_cputime.stime = 0; 1237 p->prev_cputime.utime = p->prev_cputime.stime = 0;
1235#endif 1238#endif
1239#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
1240 seqlock_init(&p->vtime_seqlock);
1241 p->vtime_snap = 0;
1242 p->vtime_snap_whence = VTIME_SLEEPING;
1243#endif
1244
1236#if defined(SPLIT_RSS_COUNTING) 1245#if defined(SPLIT_RSS_COUNTING)
1237 memset(&p->rss_stat, 0, sizeof(p->rss_stat)); 1246 memset(&p->rss_stat, 0, sizeof(p->rss_stat));
1238#endif 1247#endif
@@ -1801,7 +1810,7 @@ SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags)
1801 * If unsharing a user namespace must also unshare the thread. 1810 * If unsharing a user namespace must also unshare the thread.
1802 */ 1811 */
1803 if (unshare_flags & CLONE_NEWUSER) 1812 if (unshare_flags & CLONE_NEWUSER)
1804 unshare_flags |= CLONE_THREAD; 1813 unshare_flags |= CLONE_THREAD | CLONE_FS;
1805 /* 1814 /*
1806 * If unsharing a pid namespace must also unshare the thread. 1815 * If unsharing a pid namespace must also unshare the thread.
1807 */ 1816 */
@@ -1855,10 +1864,8 @@ SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags)
1855 exit_sem(current); 1864 exit_sem(current);
1856 } 1865 }
1857 1866
1858 if (new_nsproxy) { 1867 if (new_nsproxy)
1859 switch_task_namespaces(current, new_nsproxy); 1868 switch_task_namespaces(current, new_nsproxy);
1860 new_nsproxy = NULL;
1861 }
1862 1869
1863 task_lock(current); 1870 task_lock(current);
1864 1871
@@ -1888,9 +1895,6 @@ SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags)
1888 } 1895 }
1889 } 1896 }
1890 1897
1891 if (new_nsproxy)
1892 put_nsproxy(new_nsproxy);
1893
1894bad_unshare_cleanup_cred: 1898bad_unshare_cleanup_cred:
1895 if (new_cred) 1899 if (new_cred)
1896 put_cred(new_cred); 1900 put_cred(new_cred);