summaryrefslogtreecommitdiffstats
path: root/net/batman-adv/routing.c
diff options
context:
space:
mode:
authorMarek Lindner <lindner_marek@yahoo.de>2010-12-12 21:57:10 +0000
committerMarek Lindner <lindner_marek@yahoo.de>2011-03-05 12:49:52 +0100
commita8e7f4bc38c4a90ee308cd7f1f8604f71db59d05 (patch)
treeeaad8069534691aaa06b316ce42fbeb81f380b20 /net/batman-adv/routing.c
parent8d689218568174955129d0f0e9e4370a391b3609 (diff)
downloadlinux-a8e7f4bc38c4a90ee308cd7f1f8604f71db59d05.tar.gz
linux-a8e7f4bc38c4a90ee308cd7f1f8604f71db59d05.tar.bz2
linux-a8e7f4bc38c4a90ee308cd7f1f8604f71db59d05.zip
batman-adv: protect neighbor nodes with reference counters
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Diffstat (limited to 'net/batman-adv/routing.c')
-rw-r--r--net/batman-adv/routing.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 827414067e46..36351d374f28 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -89,6 +89,8 @@ static void update_route(struct bat_priv *bat_priv,
struct neigh_node *neigh_node,
unsigned char *hna_buff, int hna_buff_len)
{
+ struct neigh_node *neigh_node_tmp;
+
/* route deleted */
if ((orig_node->router) && (!neigh_node)) {
@@ -115,7 +117,12 @@ static void update_route(struct bat_priv *bat_priv,
orig_node->router->addr);
}
+ if (neigh_node)
+ kref_get(&neigh_node->refcount);
+ neigh_node_tmp = orig_node->router;
orig_node->router = neigh_node;
+ if (neigh_node_tmp)
+ kref_put(&neigh_node_tmp->refcount, neigh_node_free_ref);
}