summaryrefslogtreecommitdiff
path: root/net/packet/af_packet.c
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2019-07-15 11:15:02 -0300
committerGitHub <noreply@github.com>2019-07-15 11:15:02 -0300
commit6b774eec1f9d3064e9b33634dfa99d5666d0a73a (patch)
tree64fa879c312d6a52f90e6dbf3f7be2d66de3ddd4 /net/packet/af_packet.c
parent774f42075a4800fe4106dffca804e3207bc3c2e7 (diff)
parent286d8c46ed06d5fc1b8c212356a11a19b2c94bc4 (diff)
Merge pull request #50 from MaxKrummenacher/4.14-2.0.x-imx
4.14 2.0.x imx
Diffstat (limited to 'net/packet/af_packet.c')
-rw-r--r--net/packet/af_packet.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index e522316a80c7..a968e81d4c81 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -4629,14 +4629,29 @@ static void __exit packet_exit(void)
static int __init packet_init(void)
{
- int rc = proto_register(&packet_proto, 0);
+ int rc;
- if (rc != 0)
+ rc = proto_register(&packet_proto, 0);
+ if (rc)
goto out;
+ rc = sock_register(&packet_family_ops);
+ if (rc)
+ goto out_proto;
+ rc = register_pernet_subsys(&packet_net_ops);
+ if (rc)
+ goto out_sock;
+ rc = register_netdevice_notifier(&packet_netdev_notifier);
+ if (rc)
+ goto out_pernet;
- sock_register(&packet_family_ops);
- register_pernet_subsys(&packet_net_ops);
- register_netdevice_notifier(&packet_netdev_notifier);
+ return 0;
+
+out_pernet:
+ unregister_pernet_subsys(&packet_net_ops);
+out_sock:
+ sock_unregister(PF_PACKET);
+out_proto:
+ proto_unregister(&packet_proto);
out:
return rc;
}