diff options
author | Zhang Qiao <[email protected]> | 2022-01-21 18:12:10 +0800 |
---|---|---|
committer | Tejun Heo <[email protected]> | 2022-02-14 09:48:04 -1000 |
commit | 05c7b7a92cc87ff8d7fde189d0fade250697573c (patch) | |
tree | ca03eee0d94326ebdd3915f3e0127bbbdc3d4289 /net/lapb/lapb_subr.c | |
parent | 2bdfd2825c9662463371e6691b1a794e97fa36b4 (diff) |
cgroup/cpuset: Fix a race between cpuset_attach() and cpu hotplug
As previously discussed(https://lkml.org/lkml/2022/1/20/51),
cpuset_attach() is affected with similar cpu hotplug race,
as follow scenario:
cpuset_attach() cpu hotplug
--------------------------- ----------------------
down_write(cpuset_rwsem)
guarantee_online_cpus() // (load cpus_attach)
sched_cpu_deactivate
set_cpu_active()
// will change cpu_active_mask
set_cpus_allowed_ptr(cpus_attach)
__set_cpus_allowed_ptr_locked()
// (if the intersection of cpus_attach and
cpu_active_mask is empty, will return -EINVAL)
up_write(cpuset_rwsem)
To avoid races such as described above, protect cpuset_attach() call
with cpu_hotplug_lock.
Fixes: be367d099270 ("cgroups: let ss->can_attach and ss->attach do whole threadgroups at a time")
Cc: [email protected] # v2.6.32+
Reported-by: Zhao Gongyi <[email protected]>
Signed-off-by: Zhang Qiao <[email protected]>
Acked-by: Waiman Long <[email protected]>
Reviewed-by: Michal Koutný <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>
Diffstat (limited to 'net/lapb/lapb_subr.c')
0 files changed, 0 insertions, 0 deletions