diff options
author | Gao Feng <fgao@ikuai8.com> | 2016-09-09 15:25:09 (GMT) |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-09-12 17:54:43 (GMT) |
commit | 4e6577de71803142d01e374cf15664af0388799a (patch) | |
tree | 31cc9b67b0efe071ad9ea072e83dd2fc74c07a3d /net/netfilter/nf_tables_netdev.c | |
parent | cf71c03edf10076f05a0b678fc9c8f8e6c6e24e4 (diff) | |
download | linux-4e6577de71803142d01e374cf15664af0388799a.tar.xz |
netfilter: Add the missed return value check of register_netdevice_notifier
There are some codes of netfilter module which did not check the return
value of register_netdevice_notifier. Add the checks now.
Signed-off-by: Gao Feng <fgao@ikuai8.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter/nf_tables_netdev.c')
-rw-r--r-- | net/netfilter/nf_tables_netdev.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/net/netfilter/nf_tables_netdev.c b/net/netfilter/nf_tables_netdev.c index 3e5475a..38a3e83 100644 --- a/net/netfilter/nf_tables_netdev.c +++ b/net/netfilter/nf_tables_netdev.c @@ -151,12 +151,20 @@ static int __init nf_tables_netdev_init(void) nft_register_chain_type(&nft_filter_chain_netdev); ret = register_pernet_subsys(&nf_tables_netdev_net_ops); - if (ret < 0) { - nft_unregister_chain_type(&nft_filter_chain_netdev); - return ret; - } - register_netdevice_notifier(&nf_tables_netdev_notifier); + if (ret) + goto err1; + + ret = register_netdevice_notifier(&nf_tables_netdev_notifier); + if (ret) + goto err2; + return 0; + +err2: + unregister_pernet_subsys(&nf_tables_netdev_net_ops); +err1: + nft_unregister_chain_type(&nft_filter_chain_netdev); + return ret; } static void __exit nf_tables_netdev_exit(void) |