diff options
Diffstat (limited to 'net/batman-adv/network-coding.c')
-rw-r--r-- | net/batman-adv/network-coding.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/net/batman-adv/network-coding.c b/net/batman-adv/network-coding.c index c98b0ab85449..cc63b44f0d2e 100644 --- a/net/batman-adv/network-coding.c +++ b/net/batman-adv/network-coding.c | |||
@@ -203,28 +203,25 @@ void batadv_nc_init_orig(struct batadv_orig_node *orig_node) | |||
203 | } | 203 | } |
204 | 204 | ||
205 | /** | 205 | /** |
206 | * batadv_nc_node_free_rcu - rcu callback to free an nc node and remove | 206 | * batadv_nc_node_release - release nc_node from lists and queue for free after |
207 | * its refcount on the orig_node | 207 | * rcu grace period |
208 | * @rcu: rcu pointer of the nc node | 208 | * @nc_node: the nc node to free |
209 | */ | 209 | */ |
210 | static void batadv_nc_node_free_rcu(struct rcu_head *rcu) | 210 | static void batadv_nc_node_release(struct batadv_nc_node *nc_node) |
211 | { | 211 | { |
212 | struct batadv_nc_node *nc_node; | ||
213 | |||
214 | nc_node = container_of(rcu, struct batadv_nc_node, rcu); | ||
215 | batadv_orig_node_free_ref(nc_node->orig_node); | 212 | batadv_orig_node_free_ref(nc_node->orig_node); |
216 | kfree(nc_node); | 213 | kfree_rcu(nc_node, rcu); |
217 | } | 214 | } |
218 | 215 | ||
219 | /** | 216 | /** |
220 | * batadv_nc_node_free_ref - decrements the nc node refcounter and possibly | 217 | * batadv_nc_node_free_ref - decrement the nc node refcounter and possibly |
221 | * frees it | 218 | * release it |
222 | * @nc_node: the nc node to free | 219 | * @nc_node: the nc node to free |
223 | */ | 220 | */ |
224 | static void batadv_nc_node_free_ref(struct batadv_nc_node *nc_node) | 221 | static void batadv_nc_node_free_ref(struct batadv_nc_node *nc_node) |
225 | { | 222 | { |
226 | if (atomic_dec_and_test(&nc_node->refcount)) | 223 | if (atomic_dec_and_test(&nc_node->refcount)) |
227 | call_rcu(&nc_node->rcu, batadv_nc_node_free_rcu); | 224 | batadv_nc_node_release(nc_node); |
228 | } | 225 | } |
229 | 226 | ||
230 | /** | 227 | /** |