[lkml]   [2020]   [Jan]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH v2 2/2] futex: Add missing annotation to wake_futex_pi()
Sparse reprts warnings;

warning: context imbalance in wake_futex_pi() - unexpected unlock
warning: context imbalance in futex_unlock_p() - different lock contexts
for basic block

The root cause is a missing annotation at wake_futex_pi()
which also causes the "different lock contexts for basic block" warning.
To fix these,
a __releases(&pi_state) annotation is added to wake_futex_pi().
Given that wake_futex_pi() does actually call
raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock) at exit,
this fixes the warnings

Signed-off-by: Jules Irenge <>
kernel/futex.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/futex.c b/kernel/futex.c
index 0cf84c8664f2..dfcb90b47ed6 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -1549,7 +1549,8 @@ static void mark_wake_futex(struct wake_q_head *wake_q, struct futex_q *q)
* Caller must hold a reference on @pi_state.
-static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_pi_state *pi_state)
+static int wake_futex_pi(u32 __user *uaddr, u32 uval,
+ struct futex_pi_state *pi_state) __releases(&pi_state)
u32 uninitialized_var(curval), newval;
struct task_struct *new_owner;
 \ /
  Last update: 2020-01-27 03:31    [W:0.030 / U:6.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site