diff options
author | David S. Miller <davem@davemloft.net> | 2005-11-11 18:05:47 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-11-11 18:05:47 -0500 |
commit | 8eb55910521f3449a8125a38dd32fb676703395d (patch) | |
tree | 46ccf4bf582b5d7d1d240736608e33100ec02607 /net/ipv6/af_inet6.c | |
parent | 85837ebdd7bb3e96a60e9b4c6af6c60d1273bc67 (diff) |
[IPV6]: Fix inet6_init missing unregister.
Based mostly upon a patch from Olaf Kirch <okir@suse.de>
When initialization fails in inet6_init(), we should
unregister the PF_INET6 socket ops.
Also, check sock_register()'s return value for errors.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/af_inet6.c')
-rw-r--r-- | net/ipv6/af_inet6.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 4f8795af2edb..c63b8ce0e1b5 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -699,12 +699,14 @@ static int __init inet6_init(void) | |||
699 | /* Register the family here so that the init calls below will | 699 | /* Register the family here so that the init calls below will |
700 | * be able to create sockets. (?? is this dangerous ??) | 700 | * be able to create sockets. (?? is this dangerous ??) |
701 | */ | 701 | */ |
702 | (void) sock_register(&inet6_family_ops); | 702 | err = sock_register(&inet6_family_ops); |
703 | if (err) | ||
704 | goto out_unregister_raw_proto; | ||
703 | 705 | ||
704 | /* Initialise ipv6 mibs */ | 706 | /* Initialise ipv6 mibs */ |
705 | err = init_ipv6_mibs(); | 707 | err = init_ipv6_mibs(); |
706 | if (err) | 708 | if (err) |
707 | goto out_unregister_raw_proto; | 709 | goto out_unregister_sock; |
708 | 710 | ||
709 | /* | 711 | /* |
710 | * ipngwg API draft makes clear that the correct semantics | 712 | * ipngwg API draft makes clear that the correct semantics |
@@ -796,6 +798,8 @@ icmp_fail: | |||
796 | ipv6_sysctl_unregister(); | 798 | ipv6_sysctl_unregister(); |
797 | #endif | 799 | #endif |
798 | cleanup_ipv6_mibs(); | 800 | cleanup_ipv6_mibs(); |
801 | out_unregister_sock: | ||
802 | sock_unregister(PF_INET6); | ||
799 | out_unregister_raw_proto: | 803 | out_unregister_raw_proto: |
800 | proto_unregister(&rawv6_prot); | 804 | proto_unregister(&rawv6_prot); |
801 | out_unregister_udp_proto: | 805 | out_unregister_udp_proto: |