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>
This commit is contained in:
parent
3f0531e577
commit
90d78776c4
1 changed files with 5 additions and 4 deletions
|
@ -95,9 +95,11 @@ static int uid_cputime_show(struct seq_file *m, void *v)
|
||||||
{
|
{
|
||||||
struct uid_entry *uid_entry;
|
struct uid_entry *uid_entry;
|
||||||
struct task_struct *task, *temp;
|
struct task_struct *task, *temp;
|
||||||
|
struct user_namespace *user_ns = current_user_ns();
|
||||||
cputime_t utime;
|
cputime_t utime;
|
||||||
cputime_t stime;
|
cputime_t stime;
|
||||||
unsigned long bkt;
|
unsigned long bkt;
|
||||||
|
uid_t uid;
|
||||||
|
|
||||||
rt_mutex_lock(&uid_lock);
|
rt_mutex_lock(&uid_lock);
|
||||||
|
|
||||||
|
@ -108,14 +110,13 @@ static int uid_cputime_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
read_lock(&tasklist_lock);
|
read_lock(&tasklist_lock);
|
||||||
do_each_thread(temp, task) {
|
do_each_thread(temp, task) {
|
||||||
uid_entry = find_or_register_uid(from_kuid_munged(
|
uid = from_kuid_munged(user_ns, task_uid(task));
|
||||||
current_user_ns(), task_uid(task)));
|
uid_entry = find_or_register_uid(uid);
|
||||||
if (!uid_entry) {
|
if (!uid_entry) {
|
||||||
read_unlock(&tasklist_lock);
|
read_unlock(&tasklist_lock);
|
||||||
rt_mutex_unlock(&uid_lock);
|
rt_mutex_unlock(&uid_lock);
|
||||||
pr_err("%s: failed to find the uid_entry for uid %d\n",
|
pr_err("%s: failed to find the uid_entry for uid %d\n",
|
||||||
__func__, from_kuid_munged(current_user_ns(),
|
__func__, uid);
|
||||||
task_uid(task)));
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
task_cputime_adjusted(task, &utime, &stime);
|
task_cputime_adjusted(task, &utime, &stime);
|
||||||
|
|
Loading…
Add table
Reference in a new issue