diff mbox series

[v3,05/21] vxlan: exit_net cleanup checks added

Message ID 498a33a1-a62e-d776-ae61-512740e52ff1@virtuozzo.com
State Changes Requested, archived
Delegated to: David Miller
Headers show
Series exit_net checks for objects initialized in net_init hook | expand

Commit Message

Vasily Averin Nov. 6, 2017, 1:23 p.m. UTC
Be sure that sock_list array initialized in net_init hook was return
to initial state

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

Patch

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index d7c49cf..acf5763 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -3704,6 +3704,7 @@  static void __net_exit vxlan_exit_net(struct net *net)
 	struct vxlan_net *vn = net_generic(net, vxlan_net_id);
 	struct vxlan_dev *vxlan, *next;
 	struct net_device *dev, *aux;
+	unsigned int h;
 	LIST_HEAD(list);
 
 	rtnl_lock();
@@ -3723,6 +3724,12 @@  static void __net_exit vxlan_exit_net(struct net *net)
 
 	unregister_netdevice_many(&list);
 	rtnl_unlock();
+
+	for (h = 0; h < PORT_HASH_SIZE; ++h)
+		if (WARN_ONCE(!hlist_empty(&vn->sock_list[h]),
+			      "net %x %s: sock_list is not empty\n",
+			      net->ns.inum, __func__))
+			break;
 }
 
 static struct pernet_operations vxlan_net_ops = {