From: Jules Irenge <jbi.octave@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org (open list:NETWORKING [IPv4/IPv6])
Subject: [PATCH 3/6] udp: Add annotations for udp_rmem_release()
Date: Wed, 29 Apr 2020 11:05:25 +0100 [thread overview]
Message-ID: <20200429100529.19645-4-jbi.octave@gmail.com> (raw)
In-Reply-To: <20200429100529.19645-1-jbi.octave@gmail.com>
Sparse reports a warning
warning: context imbalance in udp_rmem_release() - unexpected unlock
To fix this,
__acquire(&sk_queue->lock) and __release(&sk_queue->lock) annotations
are added in case the condition is not met.
This add basically tell Sparse and not GCC to shutdown the warning
Add __acquire(&sk_queue->lock) annotation
Add the __release(&sk_queue->lock) annotation
Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
---
net/ipv4/udp.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 5ca12a945ac3..175bd14bfac8 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1382,6 +1382,9 @@ static void udp_rmem_release(struct sock *sk, int size, int partial,
sk_queue = &sk->sk_receive_queue;
if (!rx_queue_lock_held)
spin_lock(&sk_queue->lock);
+ else
+ /* annotation for sparse */
+ __acquire(&sk_queue->lock);
sk->sk_forward_alloc += size;
@@ -1398,6 +1401,9 @@ static void udp_rmem_release(struct sock *sk, int size, int partial,
if (!rx_queue_lock_held)
spin_unlock(&sk_queue->lock);
+ else
+ /* annotation for sparse */
+ __release(&sk_queue->lock);
}
/* Note: called with reader_queue.lock held.
--
2.25.3
next prev parent reply other threads:[~2020-04-29 10:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <0/6>
[not found] ` <20200429100529.19645-1-jbi.octave@gmail.com>
2020-04-29 10:05 ` [PATCH 2/6] udp: Add missing annotations for busylock_acquire() and busylock_release() Jules Irenge
2020-04-29 10:05 ` Jules Irenge [this message]
2020-04-29 10:05 ` [PATCH 4/6] net: atm: Add missing annotation for lec_seq_stop() Jules Irenge
2020-04-29 10:05 ` [PATCH 6/6] net: atm: Add annotation for lec_priv_walk() Jules Irenge
2020-04-29 10:22 ` Andy Shevchenko
2020-04-29 14:58 ` [PATCH v2] net: atm: Add annotation for lec_priv_walk() and lec_seq_stop() Jules Irenge
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=20200429100529.19645-4-jbi.octave@gmail.com \
--to=jbi.octave@gmail.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=yoshfuji@linux-ipv6.org \
/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).