diff options
author | Marek Lindner <lindner_marek@yahoo.de> | 2010-12-12 21:57:10 +0000 |
---|---|---|
committer | Marek Lindner <lindner_marek@yahoo.de> | 2011-03-05 12:49:52 +0100 |
commit | a8e7f4bc38c4a90ee308cd7f1f8604f71db59d05 (patch) | |
tree | eaad8069534691aaa06b316ce42fbeb81f380b20 /net/batman-adv/routing.c | |
parent | 8d689218568174955129d0f0e9e4370a391b3609 (diff) | |
download | op-kernel-dev-a8e7f4bc38c4a90ee308cd7f1f8604f71db59d05.zip op-kernel-dev-a8e7f4bc38c4a90ee308cd7f1f8604f71db59d05.tar.gz |
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.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index 8274140..36351d3 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); } |