[Devel] [PATCH RHEL7 COMMIT] ms/xfrm: Fix warning in xfrm6_tunnel_net_exit.

Vasily Averin vvs at virtuozzo.com
Tue Jun 15 16:05:46 MSK 2021


The commit is pushed to "branch-rh7-3.10.0-1160.31.1.vz7.181.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.31.1.vz7.181.3
------>
commit bf967f76b9b2b4092d444bc2b9eaea82859295fc
Author: Vasily Averin <vvs at virtuozzo.com>
Date:   Tue Jun 15 16:05:46 2021 +0300

    ms/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 at syzkaller.appspotmail.com
    Signed-off-by: Steffen Klassert <steffen.klassert at secunet.com>
    (cherry picked from ms commit b48c05ab5d32af2af4bc63851c153782d1c6ba42)
    VvS: reworked to use old version of xfrm_state_flush() call
         also dropped creation of xfrm_flush_gc()
    https://jira.sw.ru/browse/PSBM-130602
    Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
---
 net/ipv6/xfrm6_tunnel.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c
index 39ab663..8a01384 100644
--- a/net/ipv6/xfrm6_tunnel.c
+++ b/net/ipv6/xfrm6_tunnel.c
@@ -342,8 +342,15 @@ 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);
+	struct xfrm_audit audit_info;
 	unsigned int i;
 
+	audit_info.loginuid = INVALID_UID;
+	audit_info.sessionid = (unsigned int)-1;
+	audit_info.secid = 0;
+	xfrm_state_flush(net, IPSEC_PROTO_ANY, &audit_info);
+	flush_work(&net->xfrm.state_gc_work);
+
 	for (i = 0; i < XFRM6_TUNNEL_SPI_BYADDR_HSIZE; i++)
 		WARN_ON_ONCE(!hlist_empty(&xfrm6_tn->spi_byaddr[i]));
 


More information about the Devel mailing list