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 @@ -4578,14 +4578,29 @@ static void __exit packet_exit(void)
4578
4578
4579
4579
static int __init packet_init (void )
4580
4580
{
4581
- int rc = proto_register ( & packet_proto , 0 ) ;
4581
+ int rc ;
4582
4582
4583
- if (rc != 0 )
4583
+ rc = proto_register (& packet_proto , 0 );
4584
+ if (rc )
4584
4585
goto out ;
4586
+ rc = sock_register (& packet_family_ops );
4587
+ if (rc )
4588
+ goto out_proto ;
4589
+ rc = register_pernet_subsys (& packet_net_ops );
4590
+ if (rc )
4591
+ goto out_sock ;
4592
+ rc = register_netdevice_notifier (& packet_netdev_notifier );
4593
+ if (rc )
4594
+ goto out_pernet ;
4585
4595
4586
- sock_register (& packet_family_ops );
4587
- register_pernet_subsys (& packet_net_ops );
4588
- register_netdevice_notifier (& packet_netdev_notifier );
4596
+ return 0 ;
4597
+
4598
+ out_pernet :
4599
+ unregister_pernet_subsys (& packet_net_ops );
4600
+ out_sock :
4601
+ sock_unregister (PF_PACKET );
4602
+ out_proto :
4603
+ proto_unregister (& packet_proto );
4589
4604
out :
4590
4605
return rc ;
4591
4606
}
You can’t perform that action at this time.
0 commit comments