diff options
-rw-r--r-- | fs/proc/base.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index 77a57b5799c4..ff7a66850602 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -371,9 +371,11 @@ static int mounts_open(struct inode *inode, struct file *file) | |||
371 | 371 | ||
372 | if (task) { | 372 | if (task) { |
373 | task_lock(task); | 373 | task_lock(task); |
374 | ns = task->nsproxy->mnt_ns; | 374 | if (task->nsproxy) { |
375 | if (ns) | 375 | ns = task->nsproxy->mnt_ns; |
376 | get_mnt_ns(ns); | 376 | if (ns) |
377 | get_mnt_ns(ns); | ||
378 | } | ||
377 | task_unlock(task); | 379 | task_unlock(task); |
378 | put_task_struct(task); | 380 | put_task_struct(task); |
379 | } | 381 | } |