* [B.A.T.M.A.N.] [PATCH] batman-adv: Fix rcu_lock imbalance in find_router
@ 2011-05-05 12:15 Marek Lindner
2011-05-05 12:19 ` [B.A.T.M.A.N.] [PATCHv2] batman-adv: Fix refcount " Marek Lindner
0 siblings, 1 reply; 4+ messages in thread
From: Marek Lindner @ 2011-05-05 12:15 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Marek Lindner
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
---
routing.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/routing.c b/routing.c
index 49f5715..d8cde2b 100644
--- a/routing.c
+++ b/routing.c
@@ -1213,7 +1213,7 @@ struct neigh_node *find_router(struct bat_priv *bat_priv,
router = orig_node_get_router(orig_node);
if (!router)
- return NULL;
+ goto err;
/* without bonding, the first node should
* always choose the default router. */
@@ -1222,10 +1222,8 @@ struct neigh_node *find_router(struct bat_priv *bat_priv,
rcu_read_lock();
/* select default router to output */
router_orig = router->orig_node;
- if (!router_orig) {
- rcu_read_unlock();
- return NULL;
- }
+ if (!router_orig)
+ goto err_unlock;
if ((!recv_if) && (!bonding_enabled))
goto return_router;
@@ -1268,6 +1266,12 @@ struct neigh_node *find_router(struct bat_priv *bat_priv,
return_router:
rcu_read_unlock();
return router;
+err_unlock:
+ rcu_read_unlock();
+err:
+ if (router)
+ neigh_node_free_ref(router);
+ return NULL;
}
static int check_unicast_packet(struct sk_buff *skb, int hdr_size)
--
1.7.2.3
^ permalink raw reply related [flat|nested] 4+ messages in thread* [B.A.T.M.A.N.] [PATCHv2] batman-adv: Fix refcount imbalance in find_router
2011-05-05 12:15 [B.A.T.M.A.N.] [PATCH] batman-adv: Fix rcu_lock imbalance in find_router Marek Lindner
@ 2011-05-05 12:19 ` Marek Lindner
2011-05-05 19:01 ` Sven Eckelmann
0 siblings, 1 reply; 4+ messages in thread
From: Marek Lindner @ 2011-05-05 12:19 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Marek Lindner
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
---
Fixed wrong subject.
routing.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/routing.c b/routing.c
index 49f5715..d8cde2b 100644
--- a/routing.c
+++ b/routing.c
@@ -1213,7 +1213,7 @@ struct neigh_node *find_router(struct bat_priv *bat_priv,
router = orig_node_get_router(orig_node);
if (!router)
- return NULL;
+ goto err;
/* without bonding, the first node should
* always choose the default router. */
@@ -1222,10 +1222,8 @@ struct neigh_node *find_router(struct bat_priv *bat_priv,
rcu_read_lock();
/* select default router to output */
router_orig = router->orig_node;
- if (!router_orig) {
- rcu_read_unlock();
- return NULL;
- }
+ if (!router_orig)
+ goto err_unlock;
if ((!recv_if) && (!bonding_enabled))
goto return_router;
@@ -1268,6 +1266,12 @@ struct neigh_node *find_router(struct bat_priv *bat_priv,
return_router:
rcu_read_unlock();
return router;
+err_unlock:
+ rcu_read_unlock();
+err:
+ if (router)
+ neigh_node_free_ref(router);
+ return NULL;
}
static int check_unicast_packet(struct sk_buff *skb, int hdr_size)
--
1.7.2.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-05-05 23:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-05 12:15 [B.A.T.M.A.N.] [PATCH] batman-adv: Fix rcu_lock imbalance in find_router Marek Lindner
2011-05-05 12:19 ` [B.A.T.M.A.N.] [PATCHv2] batman-adv: Fix refcount " Marek Lindner
2011-05-05 19:01 ` Sven Eckelmann
2011-05-05 23:05 ` Marek Lindner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox