aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/base.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r--fs/proc/base.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index fbff900fd5ad..6afca09a6534 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -350,18 +350,21 @@ struct proc_mounts {
350static int mounts_open(struct inode *inode, struct file *file) 350static int mounts_open(struct inode *inode, struct file *file)
351{ 351{
352 struct task_struct *task = get_proc_task(inode); 352 struct task_struct *task = get_proc_task(inode);
353 struct nsproxy *nsp;
353 struct mnt_namespace *ns = NULL; 354 struct mnt_namespace *ns = NULL;
354 struct proc_mounts *p; 355 struct proc_mounts *p;
355 int ret = -EINVAL; 356 int ret = -EINVAL;
356 357
357 if (task) { 358 if (task) {
358 task_lock(task); 359 rcu_read_lock();
359 if (task->nsproxy) { 360 nsp = task_nsproxy(task);
360 ns = task->nsproxy->mnt_ns; 361 if (nsp) {
362 ns = nsp->mnt_ns;
361 if (ns) 363 if (ns)
362 get_mnt_ns(ns); 364 get_mnt_ns(ns);
363 } 365 }
364 task_unlock(task); 366 rcu_read_unlock();
367
365 put_task_struct(task); 368 put_task_struct(task);
366 } 369 }
367 370
@@ -424,16 +427,20 @@ static int mountstats_open(struct inode *inode, struct file *file)
424 427
425 if (!ret) { 428 if (!ret) {
426 struct seq_file *m = file->private_data; 429 struct seq_file *m = file->private_data;
430 struct nsproxy *nsp;
427 struct mnt_namespace *mnt_ns = NULL; 431 struct mnt_namespace *mnt_ns = NULL;
428 struct task_struct *task = get_proc_task(inode); 432 struct task_struct *task = get_proc_task(inode);
429 433
430 if (task) { 434 if (task) {
431 task_lock(task); 435 rcu_read_lock();
432 if (task->nsproxy) 436 nsp = task_nsproxy(task);
433 mnt_ns = task->nsproxy->mnt_ns; 437 if (nsp) {
434 if (mnt_ns) 438 mnt_ns = nsp->mnt_ns;
435 get_mnt_ns(mnt_ns); 439 if (mnt_ns)
436 task_unlock(task); 440 get_mnt_ns(mnt_ns);
441 }
442 rcu_read_unlock();
443
437 put_task_struct(task); 444 put_task_struct(task);
438 } 445 }
439 446