aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/proc/base.c3
-rw-r--r--include/linux/nsproxy.h4
2 files changed, 5 insertions, 2 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 8df27401d292..795319c54f72 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -442,7 +442,8 @@ static int mountstats_open(struct inode *inode, struct file *file)
442 442
443 if (task) { 443 if (task) {
444 task_lock(task); 444 task_lock(task);
445 namespace = task->nsproxy->namespace; 445 if (task->nsproxy)
446 namespace = task->nsproxy->namespace;
446 if (namespace) 447 if (namespace)
447 get_namespace(namespace); 448 get_namespace(namespace);
448 task_unlock(task); 449 task_unlock(task);
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h
index f6baecdeecd6..971d1c6dfc4b 100644
--- a/include/linux/nsproxy.h
+++ b/include/linux/nsproxy.h
@@ -45,8 +45,10 @@ static inline void exit_task_namespaces(struct task_struct *p)
45{ 45{
46 struct nsproxy *ns = p->nsproxy; 46 struct nsproxy *ns = p->nsproxy;
47 if (ns) { 47 if (ns) {
48 put_nsproxy(ns); 48 task_lock(p);
49 p->nsproxy = NULL; 49 p->nsproxy = NULL;
50 task_unlock(p);
51 put_nsproxy(ns);
50 } 52 }
51} 53}
52#endif 54#endif