diff options
author | Marek Lindner <lindner_marek@yahoo.de> | 2010-12-12 16:57:10 -0500 |
---|---|---|
committer | Marek Lindner <lindner_marek@yahoo.de> | 2011-03-05 06:49:52 -0500 |
commit | a8e7f4bc38c4a90ee308cd7f1f8604f71db59d05 (patch) | |
tree | eaad8069534691aaa06b316ce42fbeb81f380b20 /net/batman-adv/routing.c | |
parent | 8d689218568174955129d0f0e9e4370a391b3609 (diff) |
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 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, | |||
89 | struct neigh_node *neigh_node, | 89 | struct neigh_node *neigh_node, |
90 | unsigned char *hna_buff, int hna_buff_len) | 90 | unsigned char *hna_buff, int hna_buff_len) |
91 | { | 91 | { |
92 | struct neigh_node *neigh_node_tmp; | ||
93 | |||
92 | /* route deleted */ | 94 | /* route deleted */ |
93 | if ((orig_node->router) && (!neigh_node)) { | 95 | if ((orig_node->router) && (!neigh_node)) { |
94 | 96 | ||
@@ -115,7 +117,12 @@ static void update_route(struct bat_priv *bat_priv, | |||
115 | orig_node->router->addr); | 117 | orig_node->router->addr); |
116 | } | 118 | } |
117 | 119 | ||
120 | if (neigh_node) | ||
121 | kref_get(&neigh_node->refcount); | ||
122 | neigh_node_tmp = orig_node->router; | ||
118 | orig_node->router = neigh_node; | 123 | orig_node->router = neigh_node; |
124 | if (neigh_node_tmp) | ||
125 | kref_put(&neigh_node_tmp->refcount, neigh_node_free_ref); | ||
119 | } | 126 | } |
120 | 127 | ||
121 | 128 | ||