[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200429100529.19645-7-jbi.octave@gmail.com>
Date: Wed, 29 Apr 2020 11:05:28 +0100
From: Jules Irenge <jbi.octave@...il.com>
To: linux-kernel@...r.kernel.org
Cc: "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Dan Carpenter <dan.carpenter@...cle.com>,
Shannon Nelson <snelson@...sando.io>,
Thomas Gleixner <tglx@...utronix.de>,
"Michael S. Tsirkin" <mst@...hat.com>,
netdev@...r.kernel.org (open list:NETWORKING [GENERAL])
Subject: [PATCH 6/6] net: atm: Add annotation for lec_priv_walk()
Sparse reports a warning at lec_priv_walk()
warning: context imbalance in lec_priv_walk() - unexpected unlock
The root cause is the missing annotation at lec_priv_walk()
To fix this, __acquire() and __release() annotations
are added in case conditions are not met.
This only instruct Sparse to shutdown the warning
Add the __acquire(&priv->lec_arp_lock)
Add __release(&priv->lec_arp_lock) annotation
Signed-off-by: Jules Irenge <jbi.octave@...il.com>
---
net/atm/lec.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/atm/lec.c b/net/atm/lec.c
index 22415bc11878..6070acaa3d5c 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -886,12 +886,18 @@ static void *lec_priv_walk(struct lec_state *state, loff_t *l,
if (!state->locked) {
state->locked = priv;
spin_lock_irqsave(&priv->lec_arp_lock, state->flags);
+ } else {
+ /* annotation for sparse */
+ __acquire(&priv->lec_arp_lock);
}
if (!lec_arp_walk(state, l, priv) && !lec_misc_walk(state, l, priv)) {
spin_unlock_irqrestore(&priv->lec_arp_lock, state->flags);
state->locked = NULL;
/* Partial state reset for the next time we get called */
state->arp_table = state->misc_table = 0;
+ } else {
+ /* annotation for sparse */
+ __release(&priv->lec_arp_lock);
}
return state->locked;
}
--
2.25.3
Powered by blists - more mailing lists