From: Greg Kroah-Hartman Date: Tue, 3 Mar 2020 16:34:32 +0000 (+0100) Subject: 4.4-stable patches X-Git-Tag: v4.19.108~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ff9b166a2cf494680ab2c24da8f3a8c17ded88e1;p=thirdparty%2Fkernel%2Fstable-queue.git 4.4-stable patches added patches: padata-always-acquire-cpu_hotplug_lock-before-pinst-lock.patch --- diff --git a/queue-4.4/padata-always-acquire-cpu_hotplug_lock-before-pinst-lock.patch b/queue-4.4/padata-always-acquire-cpu_hotplug_lock-before-pinst-lock.patch new file mode 100644 index 00000000000..c66528fd091 --- /dev/null +++ b/queue-4.4/padata-always-acquire-cpu_hotplug_lock-before-pinst-lock.patch @@ -0,0 +1,67 @@ +From 38228e8848cd7dd86ccb90406af32de0cad24be3 Mon Sep 17 00:00:00 2001 +From: Daniel Jordan +Date: Tue, 3 Dec 2019 14:31:11 -0500 +Subject: padata: always acquire cpu_hotplug_lock before pinst->lock + +From: Daniel Jordan + +commit 38228e8848cd7dd86ccb90406af32de0cad24be3 upstream. + +lockdep complains when padata's paths to update cpumasks via CPU hotplug +and sysfs are both taken: + + # echo 0 > /sys/devices/system/cpu/cpu1/online + # echo ff > /sys/kernel/pcrypt/pencrypt/parallel_cpumask + + ====================================================== + WARNING: possible circular locking dependency detected + 5.4.0-rc8-padata-cpuhp-v3+ #1 Not tainted + ------------------------------------------------------ + bash/205 is trying to acquire lock: + ffffffff8286bcd0 (cpu_hotplug_lock.rw_sem){++++}, at: padata_set_cpumask+0x2b/0x120 + + but task is already holding lock: + ffff8880001abfa0 (&pinst->lock){+.+.}, at: padata_set_cpumask+0x26/0x120 + + which lock already depends on the new lock. + +padata doesn't take cpu_hotplug_lock and pinst->lock in a consistent +order. Which should be first? CPU hotplug calls into padata with +cpu_hotplug_lock already held, so it should have priority. + +Fixes: 6751fb3c0e0c ("padata: Use get_online_cpus/put_online_cpus") +Signed-off-by: Daniel Jordan +Cc: Eric Biggers +Cc: Herbert Xu +Cc: Steffen Klassert +Cc: linux-crypto@vger.kernel.org +Cc: linux-kernel@vger.kernel.org +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/padata.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/kernel/padata.c ++++ b/kernel/padata.c +@@ -640,8 +640,8 @@ int padata_set_cpumask(struct padata_ins + struct cpumask *serial_mask, *parallel_mask; + int err = -EINVAL; + +- mutex_lock(&pinst->lock); + get_online_cpus(); ++ mutex_lock(&pinst->lock); + + switch (cpumask_type) { + case PADATA_CPU_PARALLEL: +@@ -659,8 +659,8 @@ int padata_set_cpumask(struct padata_ins + err = __padata_set_cpumasks(pinst, parallel_mask, serial_mask); + + out: +- put_online_cpus(); + mutex_unlock(&pinst->lock); ++ put_online_cpus(); + + return err; + } diff --git a/queue-4.4/series b/queue-4.4/series index bf0c18fb2eb..99d230b1cb1 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -37,3 +37,4 @@ mm-gup-ensure-real-head-page-is-ref-counted-when-using-hugepages.patch mm-prevent-get_user_pages-from-overflowing-page-refcount.patch pipe-add-pipe_buf_get-helper.patch fs-prevent-page-refcount-overflow-in-pipe_buf_get.patch +padata-always-acquire-cpu_hotplug_lock-before-pinst-lock.patch