diff mbox series

[nf-next] netfilter: avoid arp/bridge WARN_ON if arp/ebtables not supported

Message ID 20180108123152.11499-1-fw@strlen.de
State Accepted
Delegated to: Pablo Neira
Headers show
Series [nf-next] netfilter: avoid arp/bridge WARN_ON if arp/ebtables not supported | expand

Commit Message

Florian Westphal Jan. 8, 2018, 12:31 p.m. UTC
We need to retain the 'case' statement, otherwise, if e.g. arp tables
isn't supported first NF_HOOK(NFPROTO_ARP, ... will produce a bogus
WARN_ON().

Fixes: 8de98f05836 ("netfilter: don't allocate space for arp/bridge hooks unless needed")
Signed-off-by: Florian Westphal <fw@strlen.de>
---
 include/linux/netfilter.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Pablo Neira Ayuso Jan. 8, 2018, 1:07 p.m. UTC | #1
On Mon, Jan 08, 2018 at 01:31:52PM +0100, Florian Westphal wrote:
> We need to retain the 'case' statement, otherwise, if e.g. arp tables
> isn't supported first NF_HOOK(NFPROTO_ARP, ... will produce a bogus
> WARN_ON().

Applied, thanks Florian.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 84987186aa26..85a1a0b32c66 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -214,16 +214,16 @@  static inline int nf_hook(u_int8_t pf, unsigned int hook, struct net *net,
 	case NFPROTO_IPV6:
 		hook_head = rcu_dereference(net->nf.hooks_ipv6[hook]);
 		break;
-#ifdef CONFIG_NETFILTER_FAMILY_ARP
 	case NFPROTO_ARP:
+#ifdef CONFIG_NETFILTER_FAMILY_ARP
 		hook_head = rcu_dereference(net->nf.hooks_arp[hook]);
-		break;
 #endif
-#ifdef CONFIG_NETFILTER_FAMILY_BRIDGE
+		break;
 	case NFPROTO_BRIDGE:
+#ifdef CONFIG_NETFILTER_FAMILY_BRIDGE
 		hook_head = rcu_dereference(net->nf.hooks_bridge[hook]);
-		break;
 #endif
+		break;
 #if IS_ENABLED(CONFIG_DECNET)
 	case NFPROTO_DECNET:
 		hook_head = rcu_dereference(net->nf.hooks_decnet[hook]);