diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2018-06-02 01:13:34 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-06-02 01:13:34 -0700 |
commit | fd95dadf54bf08e910a4cad0bbce8d25e8813429 (patch) | |
tree | 7824cada0e10c6bb934c59b3b8a3aeb09b1e812f /mm/util.c | |
parent | 33b2567cd52c95ad3b33578aaa200d53aa4d4dbc (diff) | |
parent | 9848856fe15cdad6b64b5883bb4c30528b358f7d (diff) |
Merge "Merge android-4.4.133 (3f51ea2) into msm-4.4"
Diffstat (limited to 'mm/util.c')
-rw-r--r-- | mm/util.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/mm/util.c b/mm/util.c index 9fa1aaab23d6..f5480eb305c7 100644 --- a/mm/util.c +++ b/mm/util.c @@ -430,17 +430,25 @@ int get_cmdline(struct task_struct *task, char *buffer, int buflen) int res = 0; unsigned int len; struct mm_struct *mm = get_task_mm(task); + unsigned long arg_start, arg_end, env_start, env_end; if (!mm) goto out; if (!mm->arg_end) goto out_mm; /* Shh! No looking before we're done */ - len = mm->arg_end - mm->arg_start; + down_read(&mm->mmap_sem); + arg_start = mm->arg_start; + arg_end = mm->arg_end; + env_start = mm->env_start; + env_end = mm->env_end; + up_read(&mm->mmap_sem); + + len = arg_end - arg_start; if (len > buflen) len = buflen; - res = access_process_vm(task, mm->arg_start, buffer, len, 0); + res = access_process_vm(task, arg_start, buffer, len, 0); /* * If the nul at the end of args has been overwritten, then @@ -451,10 +459,10 @@ int get_cmdline(struct task_struct *task, char *buffer, int buflen) if (len < res) { res = len; } else { - len = mm->env_end - mm->env_start; + len = env_end - env_start; if (len > buflen - res) len = buflen - res; - res += access_process_vm(task, mm->env_start, + res += access_process_vm(task, env_start, buffer+res, len, 0); res = strnlen(buffer, res); } |