From 704d923a74aa8a9e00f8d4e399117f7a61c4d0fe Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 21 Sep 2022 12:25:19 +0200 Subject: [PATCH] 5.15-stable patches added patches: cgroup-add-missing-cpus_read_lock-to-cgroup_attach_task_all.patch --- ..._read_lock-to-cgroup_attach_task_all.patch | 43 +++++++++++++++++++ queue-5.15/series | 1 + 2 files changed, 44 insertions(+) create mode 100644 queue-5.15/cgroup-add-missing-cpus_read_lock-to-cgroup_attach_task_all.patch diff --git a/queue-5.15/cgroup-add-missing-cpus_read_lock-to-cgroup_attach_task_all.patch b/queue-5.15/cgroup-add-missing-cpus_read_lock-to-cgroup_attach_task_all.patch new file mode 100644 index 00000000000..9db29bd3cc5 --- /dev/null +++ b/queue-5.15/cgroup-add-missing-cpus_read_lock-to-cgroup_attach_task_all.patch @@ -0,0 +1,43 @@ +From 43626dade36fa74d3329046f4ae2d7fdefe401c6 Mon Sep 17 00:00:00 2001 +From: Tetsuo Handa +Date: Thu, 25 Aug 2022 17:38:38 +0900 +Subject: cgroup: Add missing cpus_read_lock() to cgroup_attach_task_all() + +From: Tetsuo Handa + +commit 43626dade36fa74d3329046f4ae2d7fdefe401c6 upstream. + +syzbot is hitting percpu_rwsem_assert_held(&cpu_hotplug_lock) warning at +cpuset_attach() [1], for commit 4f7e7236435ca0ab ("cgroup: Fix +threadgroup_rwsem <-> cpus_read_lock() deadlock") missed that +cpuset_attach() is also called from cgroup_attach_task_all(). +Add cpus_read_lock() like what cgroup_procs_write_start() does. + +Link: https://syzkaller.appspot.com/bug?extid=29d3a3b4d86c8136ad9e [1] +Reported-by: syzbot +Signed-off-by: Tetsuo Handa +Fixes: 4f7e7236435ca0ab ("cgroup: Fix threadgroup_rwsem <-> cpus_read_lock() deadlock") +Signed-off-by: Tejun Heo +Signed-off-by: Greg Kroah-Hartman +--- + kernel/cgroup/cgroup-v1.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/kernel/cgroup/cgroup-v1.c ++++ b/kernel/cgroup/cgroup-v1.c +@@ -59,6 +59,7 @@ int cgroup_attach_task_all(struct task_s + int retval = 0; + + mutex_lock(&cgroup_mutex); ++ cpus_read_lock(); + percpu_down_write(&cgroup_threadgroup_rwsem); + for_each_root(root) { + struct cgroup *from_cgrp; +@@ -75,6 +76,7 @@ int cgroup_attach_task_all(struct task_s + break; + } + percpu_up_write(&cgroup_threadgroup_rwsem); ++ cpus_read_unlock(); + mutex_unlock(&cgroup_mutex); + + return retval; diff --git a/queue-5.15/series b/queue-5.15/series index 9023b6479fb..4f49ce1696a 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -41,3 +41,4 @@ mksysmap-fix-the-mismatch-of-l0-symbols-in-system.ma.patch video-fbdev-pxa3xx-gcu-fix-integer-overflow-in-pxa3x.patch net-find-dst-with-sk-s-xfrm-policy-not-ctl_sk.patch kvm-sev-add-cache-flush-to-solve-sev-cache-incoherency-issues.patch +cgroup-add-missing-cpus_read_lock-to-cgroup_attach_task_all.patch -- 2.47.3