summaryrefslogtreecommitdiffstats
path: root/net/ipv6/xfrm6_tunnel.c
diff options
context:
space:
mode:
authorSteffen Klassert <steffen.klassert@secunet.com>2018-04-16 07:50:09 +0200
committerSteffen Klassert <steffen.klassert@secunet.com>2018-04-16 07:50:09 +0200
commitb48c05ab5d32af2af4bc63851c153782d1c6ba42 (patch)
treedad80f44a4216537788e6f99a6e2d1f49abb3fce /net/ipv6/xfrm6_tunnel.c
parentaf_key: Always verify length of provided sadb_key (diff)
downloadlinux-b48c05ab5d32af2af4bc63851c153782d1c6ba42.tar.xz
linux-b48c05ab5d32af2af4bc63851c153782d1c6ba42.zip
xfrm: Fix warning in xfrm6_tunnel_net_exit.
We need to make sure that all states are really deleted before we check that the state lists are empty. Otherwise we trigger a warning. Fixes: baeb0dbbb5659 ("xfrm6_tunnel: exit_net cleanup check added") Reported-and-tested-by:syzbot+777bf170a89e7b326405@syzkaller.appspotmail.com Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net/ipv6/xfrm6_tunnel.c')
-rw-r--r--net/ipv6/xfrm6_tunnel.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c
index f85f0d7480ac..4a46df8441c9 100644
--- a/net/ipv6/xfrm6_tunnel.c
+++ b/net/ipv6/xfrm6_tunnel.c
@@ -341,6 +341,9 @@ static void __net_exit xfrm6_tunnel_net_exit(struct net *net)
struct xfrm6_tunnel_net *xfrm6_tn = xfrm6_tunnel_pernet(net);
unsigned int i;
+ xfrm_state_flush(net, IPSEC_PROTO_ANY, false);
+ xfrm_flush_gc();
+
for (i = 0; i < XFRM6_TUNNEL_SPI_BYADDR_HSIZE; i++)
WARN_ON_ONCE(!hlist_empty(&xfrm6_tn->spi_byaddr[i]));