diff mbox series

[v4,08/18] l2tp: exit_net cleanup check added

Message ID 25f9688f-7a83-bec8-cf9d-857d5792a53f@virtuozzo.com
State Superseded, archived
Delegated to: David Miller
Headers show
Series exit_net checks for objects initialized in net_init hook | expand

Commit Message

Vasily Averin Nov. 12, 2017, 8:44 a.m. UTC
Be sure that l2tp_session_hlist array initialized in net_init hook
was return to initial state.

Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
 net/l2tp/l2tp_core.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index 02d6110..eed1e21 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -1888,6 +1888,7 @@  static __net_exit void l2tp_exit_net(struct net *net)
 {
 	struct l2tp_net *pn = l2tp_pernet(net);
 	struct l2tp_tunnel *tunnel = NULL;
+	int hash;
 
 	rcu_read_lock_bh();
 	list_for_each_entry_rcu(tunnel, &pn->l2tp_tunnel_list, list) {
@@ -1897,6 +1898,10 @@  static __net_exit void l2tp_exit_net(struct net *net)
 
 	flush_workqueue(l2tp_wq);
 	rcu_barrier();
+
+	for (hash = 0; hash < L2TP_HASH_SIZE_2; hash++)
+		if (WARN_ON_ONCE(!hlist_empty(&pn->l2tp_session_hlist[hash])))
+			break;
 }
 
 static struct pernet_operations l2tp_net_ops = {