File tree 1 file changed +20
-5
lines changed 1 file changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -4598,14 +4598,29 @@ static void __exit packet_exit(void)
4598
4598
4599
4599
static int __init packet_init (void )
4600
4600
{
4601
- int rc = proto_register ( & packet_proto , 0 ) ;
4601
+ int rc ;
4602
4602
4603
- if (rc != 0 )
4603
+ rc = proto_register (& packet_proto , 0 );
4604
+ if (rc )
4604
4605
goto out ;
4606
+ rc = sock_register (& packet_family_ops );
4607
+ if (rc )
4608
+ goto out_proto ;
4609
+ rc = register_pernet_subsys (& packet_net_ops );
4610
+ if (rc )
4611
+ goto out_sock ;
4612
+ rc = register_netdevice_notifier (& packet_netdev_notifier );
4613
+ if (rc )
4614
+ goto out_pernet ;
4605
4615
4606
- sock_register (& packet_family_ops );
4607
- register_pernet_subsys (& packet_net_ops );
4608
- register_netdevice_notifier (& packet_netdev_notifier );
4616
+ return 0 ;
4617
+
4618
+ out_pernet :
4619
+ unregister_pernet_subsys (& packet_net_ops );
4620
+ out_sock :
4621
+ sock_unregister (PF_PACKET );
4622
+ out_proto :
4623
+ proto_unregister (& packet_proto );
4609
4624
out :
4610
4625
return rc ;
4611
4626
}
You can’t perform that action at this time.
0 commit comments