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