summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorZqiang <qiang1.zhang@intel.com>2021-12-17 08:42:07 +0100
committerThomas Gleixner <tglx@linutronix.de>2021-12-18 10:55:51 +0100
commit8f556a326c93213927e683fc32bbf5be1b62540a (patch)
tree08effe7cabd24285cd4a31c5d7dff81a76317f92 /kernel
parentLinux 5.16-rc5 (diff)
downloadlinux-8f556a326c93213927e683fc32bbf5be1b62540a.tar.xz
linux-8f556a326c93213927e683fc32bbf5be1b62540a.zip
locking/rtmutex: Fix incorrect condition in rtmutex_spin_on_owner()
Optimistic spinning needs to be terminated when the spinning waiter is not longer the top waiter on the lock, but the condition is negated. It terminates if the waiter is the top waiter, which is defeating the whole purpose. Fixes: c3123c431447 ("locking/rtmutex: Dont dereference waiter lockless") Signed-off-by: Zqiang <qiang1.zhang@intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20211217074207.77425-1-qiang1.zhang@intel.com
Diffstat (limited to 'kernel')
-rw-r--r--kernel/locking/rtmutex.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c
index 0c6a48dfcecb..1f25a4d7de27 100644
--- a/kernel/locking/rtmutex.c
+++ b/kernel/locking/rtmutex.c
@@ -1380,7 +1380,7 @@ static bool rtmutex_spin_on_owner(struct rt_mutex_base *lock,
* - the VCPU on which owner runs is preempted
*/
if (!owner->on_cpu || need_resched() ||
- rt_mutex_waiter_is_top_waiter(lock, waiter) ||
+ !rt_mutex_waiter_is_top_waiter(lock, waiter) ||
vcpu_is_preempted(task_cpu(owner))) {
res = false;
break;