dccp: call inet_add_protocol after register_pernet_subsys in dccp_v6_init

Patch "call inet_add_protocol after register_pernet_subsys in dccp_v4_init"
fixed a null pointer dereference issue for dccp_ipv4 module.

The same fix is needed for dccp_ipv6 module.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Xin Long 2017-06-20 15:44:44 +08:00 коммит произвёл David S. Miller
Родитель d5494acb88
Коммит a0f9a4c2ff
1 изменённых файлов: 11 добавлений и 11 удалений

Просмотреть файл

@ -1098,33 +1098,33 @@ static int __init dccp_v6_init(void)
{
int err = proto_register(&dccp_v6_prot, 1);
if (err != 0)
if (err)
goto out;
err = inet6_add_protocol(&dccp_v6_protocol, IPPROTO_DCCP);
if (err != 0)
goto out_unregister_proto;
inet6_register_protosw(&dccp_v6_protosw);
err = register_pernet_subsys(&dccp_v6_ops);
if (err != 0)
if (err)
goto out_destroy_ctl_sock;
err = inet6_add_protocol(&dccp_v6_protocol, IPPROTO_DCCP);
if (err)
goto out_unregister_proto;
out:
return err;
out_destroy_ctl_sock:
inet6_del_protocol(&dccp_v6_protocol, IPPROTO_DCCP);
inet6_unregister_protosw(&dccp_v6_protosw);
out_unregister_proto:
unregister_pernet_subsys(&dccp_v6_ops);
out_destroy_ctl_sock:
inet6_unregister_protosw(&dccp_v6_protosw);
proto_unregister(&dccp_v6_prot);
goto out;
}
static void __exit dccp_v6_exit(void)
{
unregister_pernet_subsys(&dccp_v6_ops);
inet6_del_protocol(&dccp_v6_protocol, IPPROTO_DCCP);
unregister_pernet_subsys(&dccp_v6_ops);
inet6_unregister_protosw(&dccp_v6_protosw);
proto_unregister(&dccp_v6_prot);
}