msm-sysstats: protect task->files in get_task_unreclaimable_info()
Race is observed between task exiting and accessing task's files from get_task_unreclaimable_info(), fix it by locking it. Change-Id: Ie43426696aa09222fdc4bbb2533c8a8fd18a0f7c Signed-off-by: Srinivasarao Pathipati <quic_c_spathi@quicinc.com>
This commit is contained in:
parent
814b2ee66e
commit
0b93b90ef7
@ -188,12 +188,17 @@ static unsigned long get_task_unreclaimable_info(struct task_struct *task)
|
||||
int ret = 0;
|
||||
|
||||
for_each_thread(task, thread) {
|
||||
/* task is already locked don't lock/unlock again. */
|
||||
if (task != thread)
|
||||
task_lock(thread);
|
||||
if (unlikely(!group_leader_files))
|
||||
group_leader_files = task->group_leader->files;
|
||||
files = thread->files;
|
||||
if (files && (group_leader_files != files ||
|
||||
thread == task->group_leader))
|
||||
ret = iterate_fd(files, 0, get_dma_info, &size);
|
||||
if (task != thread)
|
||||
task_unlock(thread);
|
||||
if (ret)
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user