From: Sven Eckelmann <sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r@public.gmane.org,
Marek Lindner <lindner_marek-LWAfsSFWpa4@public.gmane.org>
Subject: [PATCH 5/8] batman-adv: Fix refcount imbalance in find_router
Date: Sun, 8 May 2011 17:24:41 +0200 [thread overview]
Message-ID: <1304868284-9364-6-git-send-email-sven@narfation.org> (raw)
In-Reply-To: <1304868284-9364-1-git-send-email-sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
From: Marek Lindner <lindner_marek-LWAfsSFWpa4@public.gmane.org>
Signed-off-by: Marek Lindner <lindner_marek-LWAfsSFWpa4@public.gmane.org>
Signed-off-by: Sven Eckelmann <sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
---
net/batman-adv/routing.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 49f5715..d8cde2b 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,
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.5.1
next prev parent reply other threads:[~2011-05-08 15:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-08 15:24 pull request: batman-adv 2011-05-08 Sven Eckelmann
[not found] ` <1304868284-9364-1-git-send-email-sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
2011-05-08 15:24 ` [PATCH 1/8] batman-adv: remove misplaced comment Sven Eckelmann
2011-05-08 15:24 ` [PATCH 2/8] batman-adv: multi vlan support for bridge loop detection Sven Eckelmann
2011-05-08 15:24 ` [PATCH 3/8] batman-adv: Remove unnecessary hardif_list_lock Sven Eckelmann
2011-05-08 15:24 ` [PATCH 4/8] batman-adv: Avoid deadlock between rtnl_lock and s_active Sven Eckelmann
2011-05-08 15:24 ` Sven Eckelmann [this message]
2011-05-08 15:24 ` [PATCH 6/8] batman-adv: rename everything from *hna* into *tt* (translation table) Sven Eckelmann
2011-05-08 15:24 ` [PATCH 7/8] batman-adv: Remove multiline comments from line ending Sven Eckelmann
2011-05-08 15:24 ` [PATCH 8/8] batman-adv: remove duplicate code from function is_bidirectional_neigh() Sven Eckelmann
2011-05-08 22:40 ` pull request: batman-adv 2011-05-08 David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1304868284-9364-6-git-send-email-sven@narfation.org \
--to=sven-kadoipu9uxwei8dpzvb4nw@public.gmane.org \
--cc=b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=lindner_marek-LWAfsSFWpa4@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).