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 @@ -4603,14 +4603,29 @@ static void __exit packet_exit(void)
4603
4603
4604
4604
static int __init packet_init (void )
4605
4605
{
4606
- int rc = proto_register ( & packet_proto , 0 ) ;
4606
+ int rc ;
4607
4607
4608
- if (rc != 0 )
4608
+ rc = proto_register (& packet_proto , 0 );
4609
+ if (rc )
4609
4610
goto out ;
4611
+ rc = sock_register (& packet_family_ops );
4612
+ if (rc )
4613
+ goto out_proto ;
4614
+ rc = register_pernet_subsys (& packet_net_ops );
4615
+ if (rc )
4616
+ goto out_sock ;
4617
+ rc = register_netdevice_notifier (& packet_netdev_notifier );
4618
+ if (rc )
4619
+ goto out_pernet ;
4610
4620
4611
- sock_register (& packet_family_ops );
4612
- register_pernet_subsys (& packet_net_ops );
4613
- register_netdevice_notifier (& packet_netdev_notifier );
4621
+ return 0 ;
4622
+
4623
+ out_pernet :
4624
+ unregister_pernet_subsys (& packet_net_ops );
4625
+ out_sock :
4626
+ sock_unregister (PF_PACKET );
4627
+ out_proto :
4628
+ proto_unregister (& packet_proto );
4614
4629
out :
4615
4630
return rc ;
4616
4631
}
You can’t perform that action at this time.
0 commit comments