1 From f668a8ba91f02a52b86a3a628606b186065fba92 Mon Sep 17 00:00:00 2001
2 From: Jeremy Sowden <jeremy@azazel.net>
3 Date: Tue, 19 Mar 2019 15:39:20 +0000
4 Subject: vti4: ipip tunnel deregistration fixes.
6 [ Upstream commit 5483844c3fc18474de29f5d6733003526e0a9f78 ]
8 If tunnel registration failed during module initialization, the module
9 would fail to deregister the IPPROTO_COMP protocol and would attempt to
10 deregister the tunnel.
12 The tunnel was not deregistered during module-exit.
14 Fixes: dd9ee3444014e ("vti4: Fix a ipip packet processing bug in 'IPCOMP' virtual tunnel")
15 Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
16 Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
17 Signed-off-by: Sasha Levin <sashal@kernel.org>
19 net/ipv4/ip_vti.c | 5 +++--
20 1 file changed, 3 insertions(+), 2 deletions(-)
22 --- a/net/ipv4/ip_vti.c
23 +++ b/net/ipv4/ip_vti.c
24 @@ -648,9 +648,9 @@ static int __init vti_init(void)
28 - xfrm4_protocol_deregister(&vti_ipcomp4_protocol, IPPROTO_COMP);
30 xfrm4_tunnel_deregister(&ipip_handler, AF_INET);
32 + xfrm4_protocol_deregister(&vti_ipcomp4_protocol, IPPROTO_COMP);
33 xfrm_proto_comp_failed:
34 xfrm4_protocol_deregister(&vti_ah4_protocol, IPPROTO_AH);
36 @@ -666,6 +666,7 @@ pernet_dev_failed:
37 static void __exit vti_fini(void)
39 rtnl_link_unregister(&vti_link_ops);
40 + xfrm4_tunnel_deregister(&ipip_handler, AF_INET);
41 xfrm4_protocol_deregister(&vti_ipcomp4_protocol, IPPROTO_COMP);
42 xfrm4_protocol_deregister(&vti_ah4_protocol, IPPROTO_AH);
43 xfrm4_protocol_deregister(&vti_esp4_protocol, IPPROTO_ESP);