summaryrefslogtreecommitdiff
path: root/kernel/futex.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2013-03-01 10:17:42 (GMT)
committerScott Wood <scottwood@freescale.com>2014-04-10 00:19:23 (GMT)
commitd22bb423d5eef26976bd0f6dbb50fbcfc2410ce6 (patch)
treeb53172ad25aa56c5f95fb65258cd247b372afd37 /kernel/futex.c
parent89c8df1fae8dce3c0651fcf90dcabb8b8e7a10e0 (diff)
downloadlinux-fsl-qoriq-d22bb423d5eef26976bd0f6dbb50fbcfc2410ce6.tar.xz
futex: Ensure lock/unlock symetry versus pi_lock and hash bucket lock
In exit_pi_state_list() we have the following locking construct: spin_lock(&hb->lock); raw_spin_lock_irq(&curr->pi_lock); ... spin_unlock(&hb->lock); In !RT this works, but on RT the migrate_enable() function which is called from spin_unlock() sees atomic context due to the held pi_lock and just decrements the migrate_disable_atomic counter of the task. Now the next call to migrate_disable() sees the counter being negative and issues a warning. That check should be in migrate_enable() already. Fix this by dropping pi_lock before unlocking hb->lock and reaquire pi_lock after that again. This is safe as the loop code reevaluates head again under the pi_lock. Reported-by: Yong Zhang <yong.zhang@windriver.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Diffstat (limited to 'kernel/futex.c')
-rw-r--r--kernel/futex.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/futex.c b/kernel/futex.c
index 919b7f3..eb58a33 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -573,7 +573,9 @@ void exit_pi_state_list(struct task_struct *curr)
* task still owns the PI-state:
*/
if (head->next != next) {
+ raw_spin_unlock_irq(&curr->pi_lock);
spin_unlock(&hb->lock);
+ raw_spin_lock_irq(&curr->pi_lock);
continue;
}