anolis-cloud-kernel/kernel/locking
Roland Xu 910c0214dc rtmutex: Drop rt_mutex::wait_lock before scheduling
ANBZ: #12608

commit d33d26036a upstream.

rt_mutex_handle_deadlock() is called with rt_mutex::wait_lock held.  In the
good case it returns with the lock held and in the deadlock case it emits a
warning and goes into an endless scheduling loop with the lock held, which
triggers the 'scheduling in atomic' warning.

Unlock rt_mutex::wait_lock in the dead lock case before issuing the warning
and dropping into the schedule for ever loop.

[ tglx: Moved unlock before the WARN(), removed the pointless comment,
  	massaged changelog, added Fixes tag ]

Fixes: 3d5c9340d1 ("rtmutex: Handle deadlock detection smarter")
Signed-off-by: Roland Xu <mu001999@outlook.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/all/ME0P300MB063599BEF0743B8FA339C2CECC802@ME0P300MB0635.AUSP300.PROD.OUTLOOK.COM

[Fixes conflicts]
Fixes: CVE-2024-46829
Signed-off-by: Xiao Long <xiaolong@openanolis.org>
Signed-off-by: Tianchen Ding <dtcccc@linux.alibaba.com>
Reviewed-by: Cruz Zhao <CruzZhao@linux.alibaba.com>
Link: https://gitee.com/anolis/cloud-kernel/pulls/4365
2025-01-09 09:29:43 +00:00
..
Makefile kcsan: Make KCSAN compatible with lockdep 2020-03-21 09:41:16 +01:00
lock_events.c locking/lock_events: Don't show pvqspinlock events on bare metal 2019-04-10 10:56:05 +02:00
lock_events.h locking/lock_events: Use raw_cpu_{add,inc}() for stats 2019-06-03 12:32:56 +02:00
lock_events_list.h locking/rwsem: Adaptive disabling of reader optimistic spinning 2019-06-17 12:28:09 +02:00
lockdep.c lockdep: Fix block chain corruption 2024-08-12 06:28:58 +00:00
lockdep_internals.h locking/lockdep: Iterate lock_classes directly when reading lockdep files 2022-04-08 14:40:32 +02:00
lockdep_proc.c locking/lockdep: Iterate lock_classes directly when reading lockdep files 2022-04-08 14:40:32 +02:00
lockdep_states.h
locktorture.c locktorture: Make function torture_percpu_rwsem_init() static 2020-08-24 18:45:32 -07:00
mcs_spinlock.h locking/qspinlock: Introduce CNA into the slow path of qspinlock 2022-11-17 05:23:33 +00:00
mutex-debug.c locking/mutex: clear MUTEX_FLAGS if wait_list is empty due to signal 2021-05-26 12:06:50 +02:00
mutex-debug.h locking/mutex: clear MUTEX_FLAGS if wait_list is empty due to signal 2021-05-26 12:06:50 +02:00
mutex.c locking/mutex: Fix HANDOFF condition 2021-09-15 09:50:23 +02:00
mutex.h locking/mutex: clear MUTEX_FLAGS if wait_list is empty due to signal 2021-05-26 12:06:50 +02:00
osq_lock.c locking/osq_lock: Avoid false sharing in optimistic_spin_node 2024-11-22 07:08:48 +00:00
percpu-rwsem.c locking/percpu-rwsem: Use this_cpu_{inc,dec}() for read_count 2020-09-16 16:26:56 +02:00
qrwlock.c locking/qrwlock: Fix ordering in queued_write_lock_slowpath() 2021-04-28 13:40:00 +02:00
qspinlock.c locking/qspinlock: Introduce CNA into the slow path of qspinlock 2022-11-17 05:23:33 +00:00
qspinlock_cna.h anolis: arm64: qspinlock: add CNA support for arm64 2022-11-17 05:23:33 +00:00
qspinlock_paravirt.h locking/qspinlock: Rename mcs lock/unlock macros and make them more generic 2022-11-17 05:23:33 +00:00
qspinlock_stat.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
rtmutex-debug.c kernel: rename show_stack_loglvl() => show_stack() 2020-06-09 09:39:13 -07:00
rtmutex-debug.h
rtmutex.c rtmutex: Drop rt_mutex::wait_lock before scheduling 2025-01-09 09:29:43 +00:00
rtmutex.h
rtmutex_common.h anolis: kabi: Reserve some fields 2023-02-24 07:45:32 +00:00
rwsem.c kernel: delete repeated words in comments 2022-02-01 17:25:45 +01:00
rwsem.h locking/percpu-rwsem: Remove the embedded rwsem 2020-02-11 13:10:56 +01:00
semaphore.c kernel: delete repeated words in comments 2022-02-01 17:25:45 +01:00
spinlock.c asm-generic/mmiowb: Add generic implementation of mmiowb() tracking 2019-04-08 11:59:39 +01:00
spinlock_debug.c lockdep: Introduce wait-type checks 2020-03-21 16:00:24 +01:00
test-ww_mutex.c locking/ww_mutex/test: Fix potential workqueue corruption 2025-01-09 09:18:16 +00:00