netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] netfilter: sanity checks on NFPROTO_NUMPROTO
@ 2012-05-14 13:56 Alban Crequy
  2012-05-14 13:56 ` [PATCH 2/6] netfilter: decnet: switch hook PFs to nfproto Alban Crequy
                   ` (6 more replies)
  0 siblings, 7 replies; 22+ messages in thread
From: Alban Crequy @ 2012-05-14 13:56 UTC (permalink / raw)
  To: Pablo Neira Ayuso, Patrick McHardy
  Cc: Vincent Sanders, Javier Martinez Canillas, netfilter-devel,
	netdev, Alban Crequy

With the NFPROTO_* constants introduced by commit 7e9c6e ("netfilter: Introduce
NFPROTO_* constants"), it is too easy to confuse PF_* and NFPROTO_* constants
in new protocols.

Signed-off-by: Alban Crequy <alban.crequy@collabora.co.uk>
Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Reviewed-by: Vincent Sanders <vincent.sanders@collabora.co.uk>
---
 net/netfilter/core.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/net/netfilter/core.c b/net/netfilter/core.c
index e1b7e05..4f16552 100644
--- a/net/netfilter/core.c
+++ b/net/netfilter/core.c
@@ -67,6 +67,11 @@ int nf_register_hook(struct nf_hook_ops *reg)
 	struct nf_hook_ops *elem;
 	int err;
 
+	if (reg->pf >= NFPROTO_NUMPROTO || reg->hooknum >= NF_MAX_HOOKS) {
+		BUG();
+		return 1;
+	}
+
 	err = mutex_lock_interruptible(&nf_hook_mutex);
 	if (err < 0)
 		return err;
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2012-06-06  0:03 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-14 13:56 [PATCH 1/6] netfilter: sanity checks on NFPROTO_NUMPROTO Alban Crequy
2012-05-14 13:56 ` [PATCH 2/6] netfilter: decnet: switch hook PFs to nfproto Alban Crequy
2012-05-14 14:18   ` David Laight
2012-05-14 14:22     ` Florian Westphal
2012-05-14 14:38     ` Pablo Neira Ayuso
2012-05-14 15:06     ` Jan Engelhardt
2012-05-14 14:45   ` Pablo Neira Ayuso
2012-06-06  0:02   ` Pablo Neira Ayuso
2012-05-14 13:56 ` [PATCH 3/6] netfilter: bridge: " Alban Crequy
2012-06-06  0:03   ` Pablo Neira Ayuso
2012-05-14 13:56 ` [PATCH 4/6] netfilter: ipv4, defrag: " Alban Crequy
2012-06-06  0:03   ` Pablo Neira Ayuso
2012-05-14 13:56 ` [PATCH 5/6] netfilter: ipvs: " Alban Crequy
2012-06-06  0:03   ` Pablo Neira Ayuso
2012-05-14 13:56 ` [PATCH 6/6] netfilter: selinux: " Alban Crequy
2012-06-06  0:03   ` Pablo Neira Ayuso
2012-05-14 14:42 ` [PATCH 1/6] netfilter: sanity checks on NFPROTO_NUMPROTO Pablo Neira Ayuso
2012-05-14 15:39   ` Alban Crequy
2012-05-14 16:04     ` [PATCH v2 " Alban Crequy
2012-05-14 19:04       ` Pablo Neira Ayuso
2012-05-15 12:32         ` [PATCH v3 " Alban Crequy
2012-05-14 15:00 ` [PATCH " Jan Engelhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).