[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200429100529.19645-4-jbi.octave@gmail.com>
Date: Wed, 29 Apr 2020 11:05:25 +0100
From: Jules Irenge <jbi.octave@...il.com>
To: linux-kernel@...r.kernel.org
Cc: "David S. Miller" <davem@...emloft.net>,
Alexey Kuznetsov <kuznet@....inr.ac.ru>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
Jakub Kicinski <kuba@...nel.org>,
netdev@...r.kernel.org (open list:NETWORKING [IPv4/IPv6])
Subject: [PATCH 3/6] udp: Add annotations for udp_rmem_release()
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@...il.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
Powered by blists - more mailing lists