linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH STABLE 4.4] futex: fix spin_lock() / spin_unlock_irq() imbalance
@ 2021-03-05 15:33 Thomas Schoebel-Theuer
  0 siblings, 0 replies; only message in thread
From: Thomas Schoebel-Theuer @ 2021-03-05 15:33 UTC (permalink / raw)
  To: tst, Greg Kroah-Hartman, Lee Jones, Peter Zijlstra,
	Thomas Gleixner, Ingo Molnar, Thomas Schoebel-Theuer,
	Arnd Bergmann, open list

From: Thomas Schoebel-Theuer <tst@1und1.de>

The following is obviously incorrect:

static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_q *this,
             struct futex_hash_bucket *hb)
{
[...]
	raw_spin_lock(&pi_state->pi_mutex.wait_lock);
[...]
	raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock);
[...]
}

The 4.4-specific fix should probably go into the direction of
b4abf91047c.

Probably, backporting of b4abf91047c
to 4.4 LTS could be another good idea.

However, this might involve some more 4.4-specific work and
require thorough testing:

> git log --oneline v4.4..b4abf91047c -- kernel/futex.c kernel/locking/rtmutex.c | wc -l
10

So this patch is just an obvious quickfix for now.

Signed-off-by: Thomas Schoebel-Theuer <tst@1und1.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fixes: 394fc498142
Fixes: 6510e4a2d04
---
 kernel/futex.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/futex.c b/kernel/futex.c
index 70ad21bbb1d5..4a707bc7cceb 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -1406,7 +1406,7 @@ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_q *this,
 	if (pi_state->owner != current)
 		return -EINVAL;
 
-	raw_spin_lock(&pi_state->pi_mutex.wait_lock);
+	raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock);
 	new_owner = rt_mutex_next_owner(&pi_state->pi_mutex);
 
 	/*
-- 
2.26.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-05 15:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-05 15:33 [PATCH STABLE 4.4] futex: fix spin_lock() / spin_unlock_irq() imbalance Thomas Schoebel-Theuer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).