aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/flow.c
diff options
context:
space:
mode:
authorSteffen Klassert <steffen.klassert@secunet.com>2014-03-12 04:43:17 -0400
committerDavid S. Miller <davem@davemloft.net>2014-03-12 15:31:18 -0400
commit4a93f5095a628d812b0b30c16d7bacea1efd783c (patch)
tree58d93f95f1e9a63cd0b1e052ddf2e32e0c7eb390 /net/core/flow.c
parent1f36fc74d87fd6b09d8326879882a60c5399fe29 (diff)
flowcache: Fix resource leaks on namespace exit.
We leak an active timer, the hotcpu notifier and all allocated resources when we exit a namespace. Fix this by introducing a flow_cache_fini() function where we release the resources before we exit. Fixes: ca925cf1534e ("flowcache: Make flow cache name space aware") Reported-by: Jakub Kicinski <moorray3@wp.pl> Tested-by: Jakub Kicinski <moorray3@wp.pl> Cc: Eric Dumazet <eric.dumazet@gmail.com> Cc: Fan Du <fan.du@windriver.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/flow.c')
-rw-r--r--net/core/flow.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/net/core/flow.c b/net/core/flow.c
index 102f8ea2eb6e..31cfb365e0c6 100644
--- a/net/core/flow.c
+++ b/net/core/flow.c
@@ -484,3 +484,22 @@ err:
484 return -ENOMEM; 484 return -ENOMEM;
485} 485}
486EXPORT_SYMBOL(flow_cache_init); 486EXPORT_SYMBOL(flow_cache_init);
487
488void flow_cache_fini(struct net *net)
489{
490 int i;
491 struct flow_cache *fc = &net->xfrm.flow_cache_global;
492
493 del_timer_sync(&fc->rnd_timer);
494 unregister_hotcpu_notifier(&fc->hotcpu_notifier);
495
496 for_each_possible_cpu(i) {
497 struct flow_cache_percpu *fcp = per_cpu_ptr(fc->percpu, i);
498 kfree(fcp->hash_table);
499 fcp->hash_table = NULL;
500 }
501
502 free_percpu(fc->percpu);
503 fc->percpu = NULL;
504}
505EXPORT_SYMBOL(flow_cache_fini);