[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>
This commit is contained in:
parent
85837ebdd7
commit
8eb5591052
|
@ -699,12 +699,14 @@ static int __init inet6_init(void)
|
||||||
/* Register the family here so that the init calls below will
|
/* Register the family here so that the init calls below will
|
||||||
* be able to create sockets. (?? is this dangerous ??)
|
* be able to create sockets. (?? is this dangerous ??)
|
||||||
*/
|
*/
|
||||||
(void) sock_register(&inet6_family_ops);
|
err = sock_register(&inet6_family_ops);
|
||||||
|
if (err)
|
||||||
|
goto out_unregister_raw_proto;
|
||||||
|
|
||||||
/* Initialise ipv6 mibs */
|
/* Initialise ipv6 mibs */
|
||||||
err = init_ipv6_mibs();
|
err = init_ipv6_mibs();
|
||||||
if (err)
|
if (err)
|
||||||
goto out_unregister_raw_proto;
|
goto out_unregister_sock;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ipngwg API draft makes clear that the correct semantics
|
* ipngwg API draft makes clear that the correct semantics
|
||||||
|
@ -796,6 +798,8 @@ static int __init inet6_init(void)
|
||||||
ipv6_sysctl_unregister();
|
ipv6_sysctl_unregister();
|
||||||
#endif
|
#endif
|
||||||
cleanup_ipv6_mibs();
|
cleanup_ipv6_mibs();
|
||||||
|
out_unregister_sock:
|
||||||
|
sock_unregister(PF_INET6);
|
||||||
out_unregister_raw_proto:
|
out_unregister_raw_proto:
|
||||||
proto_unregister(&rawv6_prot);
|
proto_unregister(&rawv6_prot);
|
||||||
out_unregister_udp_proto:
|
out_unregister_udp_proto:
|
||||||
|
|
Loading…
Reference in New Issue