ipv6: Do cleanup for ip6_mr_init.
If do not do it, we will get following issues:
1. Leaving junks after inet6_init failing halfway.
2. Leaving proc and notifier junks after ipv6 modules unloading.
Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 3ce8d2f..6b39af1 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -953,7 +953,9 @@
if (err)
goto icmp_fail;
#ifdef CONFIG_IPV6_MROUTE
- ip6_mr_init();
+ err = ip6_mr_init();
+ if (err)
+ goto ipmr_fail;
#endif
err = ndisc_init();
if (err)
@@ -1057,6 +1059,10 @@
igmp_fail:
ndisc_cleanup();
ndisc_fail:
+#ifdef CONFIG_IPV6_MROUTE
+ ip6_mr_cleanup();
+ipmr_fail:
+#endif
icmpv6_cleanup();
icmp_fail:
unregister_pernet_subsys(&inet6_net_ops);
@@ -1111,6 +1117,9 @@
ipv6_netfilter_fini();
igmp6_cleanup();
ndisc_cleanup();
+#ifdef CONFIG_IPV6_MROUTE
+ ip6_mr_cleanup();
+#endif
icmpv6_cleanup();
rawv6_exit();