From: Jules Irenge <jbi.octave@gmail.com>
To: boqun.feng@gmail.com
Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de,
dvhart@infradead.org, peterz@infradead.org, mingo@redhat.com,
Jules Irenge <jbi.octave@gmail.com>
Subject: [PATCH v2 2/2] futex: Add missing annotation to wake_futex_pi()
Date: Mon, 27 Jan 2020 02:30:51 +0000 [thread overview]
Message-ID: <20200127023052.87188-1-jbi.octave@gmail.com> (raw)
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 <jbi.octave@gmail.com>
---
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;
--
2.24.1
reply other threads:[~2020-01-27 2:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200127023052.87188-1-jbi.octave@gmail.com \
--to=jbi.octave@gmail.com \
--cc=boqun.feng@gmail.com \
--cc=dvhart@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).