Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rtmutex: Plug preempt count leak in rt_mutex_futex_unlock()

mark_wakeup_next_waiter() already disables preemption, doing so again
leaves us with an unpaired preempt_disable().

Fixes: 2a1c60299406 ("rtmutex: Deboost before waking up the top waiter")
Signed-off-by: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: xlpang@redhat.com
Cc: rostedt@goodmis.org
Link: http://lkml.kernel.org/r/1491379707.6538.2.camel@gmx.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

authored by

Mike Galbraith and committed by
Thomas Gleixner
def34eaa 19830e55

+5 -5
+5 -5
kernel/locking/rtmutex.c
··· 1581 1581 return false; /* done */ 1582 1582 } 1583 1583 1584 - mark_wakeup_next_waiter(wake_q, lock); 1585 1584 /* 1586 - * We've already deboosted, retain preempt_disabled when dropping 1587 - * the wait_lock to avoid inversion until the wakeup. Matched 1588 - * by rt_mutex_postunlock(); 1585 + * We've already deboosted, mark_wakeup_next_waiter() will 1586 + * retain preempt_disabled when we drop the wait_lock, to 1587 + * avoid inversion prior to the wakeup. preempt_disable() 1588 + * therein pairs with rt_mutex_postunlock(). 1589 1589 */ 1590 - preempt_disable(); 1590 + mark_wakeup_next_waiter(wake_q, lock); 1591 1591 1592 1592 return true; /* call postunlock() */ 1593 1593 }