diff options
-rw-r--r-- | fs/proc/base.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index 1ace83d004be..402976ab746a 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -905,7 +905,8 @@ static ssize_t environ_read(struct file *file, char __user *buf, mm = mm_for_maps(task); ret = PTR_ERR(mm); - if (!mm || IS_ERR(mm)) + /* Ensure the process spawned far enough to have an environment. */ + if (!mm || IS_ERR(mm) || !mm->env_end) goto out_free; ret = 0; |