From: Vasily Averin Subject: [PATCH v4 18/18] xfrm6_tunnel: exit_net cleanup check added Date: Sun, 12 Nov 2017 11:51:14 +0300 Message-ID: <872520c7-8c52-ff74-4e64-0fc33e7cc1f0@virtuozzo.com> References: <9dfa013e-9098-e155-9c47-a73753338288@virtuozzo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: Steffen Klassert , Herbert Xu , Hideaki YOSHIFUJI To: netdev@vger.kernel.org Return-path: Received: from mailhub.sw.ru ([195.214.232.25]:13689 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753052AbdKLIvZ (ORCPT ); Sun, 12 Nov 2017 03:51:25 -0500 In-Reply-To: <9dfa013e-9098-e155-9c47-a73753338288@virtuozzo.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: Be sure that spi_byaddr and spi_byspi arrays initialized in net_init hook were return to initial state Signed-off-by: Vasily Averin --- net/ipv6/xfrm6_tunnel.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c index 4e438bc..09ec069 100644 --- a/net/ipv6/xfrm6_tunnel.c +++ b/net/ipv6/xfrm6_tunnel.c @@ -338,6 +338,16 @@ static int __net_init xfrm6_tunnel_net_init(struct net *net) static void __net_exit xfrm6_tunnel_net_exit(struct net *net) { + struct xfrm6_tunnel_net *xfrm6_tn = xfrm6_tunnel_pernet(net); + unsigned int i; + + for (i = 0; i < XFRM6_TUNNEL_SPI_BYADDR_HSIZE; i++) + if (WARN_ON_ONCE(!hlist_empty(&xfrm6_tn->spi_byaddr[i]))) + break; + + for (i = 0; i < XFRM6_TUNNEL_SPI_BYSPI_HSIZE; i++) + if (WARN_ON_ONCE(!hlist_empty(&xfrm6_tn->spi_byspi[i]))) + break; } static struct pernet_operations xfrm6_tunnel_net_ops = { -- 2.7.4