aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/batman-adv/routing.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 49f571553050..d8cde2b8d1cf 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -1213,7 +1213,7 @@ struct neigh_node *find_router(struct bat_priv *bat_priv,
1213 1213
1214 router = orig_node_get_router(orig_node); 1214 router = orig_node_get_router(orig_node);
1215 if (!router) 1215 if (!router)
1216 return NULL; 1216 goto err;
1217 1217
1218 /* without bonding, the first node should 1218 /* without bonding, the first node should
1219 * always choose the default router. */ 1219 * always choose the default router. */
@@ -1222,10 +1222,8 @@ struct neigh_node *find_router(struct bat_priv *bat_priv,
1222 rcu_read_lock(); 1222 rcu_read_lock();
1223 /* select default router to output */ 1223 /* select default router to output */
1224 router_orig = router->orig_node; 1224 router_orig = router->orig_node;
1225 if (!router_orig) { 1225 if (!router_orig)
1226 rcu_read_unlock(); 1226 goto err_unlock;
1227 return NULL;
1228 }
1229 1227
1230 if ((!recv_if) && (!bonding_enabled)) 1228 if ((!recv_if) && (!bonding_enabled))
1231 goto return_router; 1229 goto return_router;
@@ -1268,6 +1266,12 @@ struct neigh_node *find_router(struct bat_priv *bat_priv,
1268return_router: 1266return_router:
1269 rcu_read_unlock(); 1267 rcu_read_unlock();
1270 return router; 1268 return router;
1269err_unlock:
1270 rcu_read_unlock();
1271err:
1272 if (router)
1273 neigh_node_free_ref(router);
1274 return NULL;
1271} 1275}
1272 1276
1273static int check_unicast_packet(struct sk_buff *skb, int hdr_size) 1277static int check_unicast_packet(struct sk_buff *skb, int hdr_size)