]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
cpuset: Fix unsafe lock order between cpuset lock and cpuslock
authorZhang Qiao <zhangqiao22@huawei.com>
Thu, 17 Mar 2022 02:41:57 +0000 (10:41 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Mar 2022 08:10:41 +0000 (09:10 +0100)
commitaa44002e7db25f333ddf412fb81e8db6c100841a
tree4970f25f31e353e1789524735c39061c74e35cbf
parent1ba1ec19460247ebe8b41c9a883d55f633c1282d
cpuset: Fix unsafe lock order between cpuset lock and cpuslock

The backport commit 4eec5fe1c680a ("cgroup/cpuset: Fix a race
between cpuset_attach() and cpu hotplug") looks suspicious since
it comes before commit d74b27d63a8b ("cgroup/cpuset: Change
cpuset_rwsem and hotplug lock order") v5.4-rc1~176^2~30 when
the locking order was: cpuset lock, cpus lock.

Fix it with the correct locking order and reduce the cpus locking
range because only set_cpus_allowed_ptr() needs the protection of
cpus lock.

Fixes: 4eec5fe1c680a ("cgroup/cpuset: Fix a race between cpuset_attach() and cpu hotplug")
Reported-by: Michal Koutný <mkoutny@suse.com>
Signed-off-by: Zhang Qiao <zhangqiao22@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/cgroup/cpuset.c