diff options
| author | Ganesh Mahendran <opensource.ganesh@gmail.com> | 2017-04-25 18:07:43 +0800 |
|---|---|---|
| committer | Moyster <oysterized@gmail.com> | 2017-05-24 20:46:09 +0200 |
| commit | 18fd4b0aa6d0ca755a2539740cf49dad62d40f65 (patch) | |
| tree | b9a3a49b22aa4ad9febd45564c6c756f8098f353 | |
| parent | 7adc6aada90848ce86fe4fe80e9bf9a26427dfff (diff) | |
ANDROID: uid_sys_stats: fix access of task_uid(task)
struct task_struct *task should be proteced by tasklist_lock.
Change-Id: Iefcd13442a9b9d855a2bbcde9fd838a4132fee58
Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>
(cherry picked from commit 90d78776c4a0e13fb7ee5bd0787f04a1730631a6)
| -rw-r--r-- | drivers/misc/uid_sys_stats.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/misc/uid_sys_stats.c b/drivers/misc/uid_sys_stats.c index e2a9a6d3b..423b5347e 100644 --- a/drivers/misc/uid_sys_stats.c +++ b/drivers/misc/uid_sys_stats.c @@ -101,9 +101,11 @@ static int uid_cputime_show(struct seq_file *m, void *v) { struct uid_entry *uid_entry; struct task_struct *task, *temp; + struct user_namespace *user_ns = current_user_ns(); cputime_t utime; cputime_t stime; unsigned long bkt; + uid_t uid; rt_mutex_lock(&uid_lock); @@ -115,14 +117,13 @@ static int uid_cputime_show(struct seq_file *m, void *v) read_lock(&tasklist_lock); do_each_thread(temp, task) { - uid_entry = find_or_register_uid(from_kuid_munged( - current_user_ns(), task_uid(task))); + uid = from_kuid_munged(user_ns, task_uid(task)); + uid_entry = find_or_register_uid(uid); if (!uid_entry) { read_unlock(&tasklist_lock); rt_mutex_unlock(&uid_lock); pr_err("%s: failed to find the uid_entry for uid %d\n", - __func__, from_kuid_munged(current_user_ns(), - task_uid(task))); + __func__, uid); return -ENOMEM; } /* if this task is exiting, we have already accounted for the |
