mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
cgroups: add lock for child->cgroups in cgroup_post_fork()
When cgroup_post_fork() is called, child is seen by find_task_by_vpid(), so child->cgroups maybe be changed, It'll incorrect. child->cgroups<old>'s refcnt is decreased child->cgroups<new>'s refcnt is increased but child->cg_list is added to child->cgroups<old>'s list. Signed-off-by: Lai Jiangshan <[email protected]> Reviewed-by: Paul Menage <[email protected]> Cc: KAMEZAWA Hiroyuki <[email protected]> Cc: Pavel Emelyanov <[email protected]> Cc: Balbir Singh <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
c9d5409f8d
commit
b12b533fa5
1 changed files with 2 additions and 0 deletions
|
|
@ -2792,8 +2792,10 @@ void cgroup_post_fork(struct task_struct *child)
|
|||
{
|
||||
if (use_task_css_set_links) {
|
||||
write_lock(&css_set_lock);
|
||||
task_lock(child);
|
||||
if (list_empty(&child->cg_list))
|
||||
list_add(&child->cg_list, &child->cgroups->tasks);
|
||||
task_unlock(child);
|
||||
write_unlock(&css_set_lock);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue