diff options
author | Artem Savkov <asavkov@redhat.com> | 2017-09-26 18:35:45 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2017-09-29 13:36:06 +0200 |
commit | e6b72ee88a56bcfe63f72e9c30766484c45bec72 (patch) | |
tree | 6b3cafcc56342070fa0da916ddbb9672138411f1 /net/bridge/netfilter/ebtable_filter.c | |
parent | 0d18779be13766b33c69cbc26df38383598da373 (diff) | |
download | linux-e6b72ee88a56bcfe63f72e9c30766484c45bec72.tar.bz2 |
netfilter: ebtables: fix race condition in frame_filter_net_init()
It is possible for ebt_in_hook to be triggered before ebt_table is assigned
resulting in a NULL-pointer dereference. Make sure hooks are
registered as the last step.
Fixes: aee12a0a3727 ("ebtables: remove nf_hook_register usage")
Signed-off-by: Artem Savkov <asavkov@redhat.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/bridge/netfilter/ebtable_filter.c')
-rw-r--r-- | net/bridge/netfilter/ebtable_filter.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/bridge/netfilter/ebtable_filter.c b/net/bridge/netfilter/ebtable_filter.c index 45a00dbdbcad..c41da5fac84f 100644 --- a/net/bridge/netfilter/ebtable_filter.c +++ b/net/bridge/netfilter/ebtable_filter.c @@ -93,8 +93,8 @@ static const struct nf_hook_ops ebt_ops_filter[] = { static int __net_init frame_filter_net_init(struct net *net) { - net->xt.frame_filter = ebt_register_table(net, &frame_filter, ebt_ops_filter); - return PTR_ERR_OR_ZERO(net->xt.frame_filter); + return ebt_register_table(net, &frame_filter, ebt_ops_filter, + &net->xt.frame_filter); } static void __net_exit frame_filter_net_exit(struct net *net) |