batman-adv: Fix rcu_lock imbalance in softif_neigh_get

Message ID 1304536498-22584-1-git-send-email-sven@narfation.org (mailing list archive)
State Accepted, archived
Commit 3c56ec9576d5b25beb9870cf8cf7ee7a50ea94c9
Headers

Commit Message

Sven Eckelmann May 4, 2011, 7:14 p.m. UTC
  Fix extra rcu_read_unlock after an failed softif_neigh_vid_get in
softif_neigh_get introduced by 0281a6aab718965d7c0ef45c4ba22e305f6aefe7

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 soft-interface.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
  

Comments

Marek Lindner May 4, 2011, 10:53 p.m. UTC | #1
On Wednesday 04 May 2011 21:14:58 Sven Eckelmann wrote:
> Fix extra rcu_read_unlock after an failed softif_neigh_vid_get in
> softif_neigh_get introduced by 0281a6aab718965d7c0ef45c4ba22e305f6aefe7

Good catch!

Applied in revision 3c56ec9.


Thanks,
Marek
  

Patch

diff --git a/soft-interface.c b/soft-interface.c
index 1827734..8023c4e 100644
--- a/soft-interface.c
+++ b/soft-interface.c
@@ -175,12 +175,12 @@  static struct softif_neigh *softif_neigh_get(struct bat_priv *bat_priv,
 			continue;
 
 		softif_neigh->last_seen = jiffies;
-		goto out;
+		goto unlock;
 	}
 
 	softif_neigh = kzalloc(sizeof(struct softif_neigh), GFP_ATOMIC);
 	if (!softif_neigh)
-		goto out;
+		goto unlock;
 
 	memcpy(softif_neigh->addr, addr, ETH_ALEN);
 	softif_neigh->last_seen = jiffies;
@@ -193,8 +193,9 @@  static struct softif_neigh *softif_neigh_get(struct bat_priv *bat_priv,
 			   &softif_neigh_vid->softif_neigh_list);
 	spin_unlock_bh(&bat_priv->softif_neigh_lock);
 
-out:
+unlock:
 	rcu_read_unlock();
+out:
 	if (softif_neigh_vid)
 		softif_neigh_vid_free_ref(softif_neigh_vid);
 	return softif_neigh;