Skip to content

Commit 6ee02a5

Browse files
suyj-fnstklassert
authored andcommitted
xfrm6_tunnel: Fix potential panic when unloading xfrm6_tunnel module
When unloading xfrm6_tunnel module, xfrm6_tunnel_fini directly frees the xfrm6_tunnel_spi_kmem. Maybe someone has gotten the xfrm6_tunnel_spi, so need to wait it. Fixes: 91cc3bb("xfrm6_tunnel: RCU conversion") Signed-off-by: Su Yanjun <[email protected]> Acked-by: Herbert Xu <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
1 parent f10e001 commit 6ee02a5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

net/ipv6/xfrm6_tunnel.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,10 @@ static void __exit xfrm6_tunnel_fini(void)
402402
xfrm6_tunnel_deregister(&xfrm6_tunnel_handler, AF_INET6);
403403
xfrm_unregister_type(&xfrm6_tunnel_type, AF_INET6);
404404
unregister_pernet_subsys(&xfrm6_tunnel_net_ops);
405+
/* Someone maybe has gotten the xfrm6_tunnel_spi.
406+
* So need to wait it.
407+
*/
408+
rcu_barrier();
405409
kmem_cache_destroy(xfrm6_tunnel_spi_kmem);
406410
}
407411

0 commit comments

Comments
 (0)