summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
authorArtem Savkov <asavkov@redhat.com>2017-09-26 18:35:45 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2017-09-29 13:36:06 +0200
commite6b72ee88a56bcfe63f72e9c30766484c45bec72 (patch)
tree6b3cafcc56342070fa0da916ddbb9672138411f1 /include
parent0d18779be13766b33c69cbc26df38383598da373 (diff)
downloadlinux-e6b72ee88a56bcfe63f72e9c30766484c45bec72.tar.gz
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 'include')
-rw-r--r--include/linux/netfilter_bridge/ebtables.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h
index 2c2a5514b0df..528b24c78308 100644
--- a/include/linux/netfilter_bridge/ebtables.h
+++ b/include/linux/netfilter_bridge/ebtables.h
@@ -108,9 +108,10 @@ struct ebt_table {
 
 #define EBT_ALIGN(s) (((s) + (__alignof__(struct _xt_align)-1)) & \
 		     ~(__alignof__(struct _xt_align)-1))
-extern struct ebt_table *ebt_register_table(struct net *net,
-					    const struct ebt_table *table,
-					    const struct nf_hook_ops *);
+extern int ebt_register_table(struct net *net,
+			      const struct ebt_table *table,
+			      const struct nf_hook_ops *ops,
+			      struct ebt_table **res);
 extern void ebt_unregister_table(struct net *net, struct ebt_table *table,
 				 const struct nf_hook_ops *);
 extern unsigned int ebt_do_table(struct sk_buff *skb,