summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorHarald Welte <laforge@netfilter.org>2005-08-10 03:23:53 (GMT)
committerDavid S. Miller <davem@sunset.davemloft.net>2005-08-29 22:51:25 (GMT)
commit8a61fadb3908454ccfa538aaa75eb1d22def5700 (patch)
treee3e2b131c03b3cab2f81e6cdeeaadf50071046b9 /net
parentd72367b6f36e557f122beefaa8c6b80eb1c7f245 (diff)
downloadlinux-8a61fadb3908454ccfa538aaa75eb1d22def5700.tar.xz
[NETFILTER]: check nf_log function call arguments
Check whether pf is too large in order to prevent array overflow. Signed-off-by: Harald Welte <laforge@netfilter.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/nf_log.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c
index e104760..573e76a 100644
--- a/net/netfilter/nf_log.c
+++ b/net/netfilter/nf_log.c
@@ -24,6 +24,9 @@ int nf_log_register(int pf, struct nf_logger *logger)
{
int ret = -EBUSY;
+ if (pf >= NPROTO)
+ return -EINVAL;
+
/* Any setup of logging members must be done before
* substituting pointer. */
spin_lock(&nf_log_lock);
@@ -38,14 +41,19 @@ int nf_log_register(int pf, struct nf_logger *logger)
}
EXPORT_SYMBOL(nf_log_register);
-void nf_log_unregister_pf(int pf)
+int nf_log_unregister_pf(int pf)
{
+ if (pf >= NPROTO)
+ return -EINVAL;
+
spin_lock(&nf_log_lock);
nf_logging[pf] = NULL;
spin_unlock(&nf_log_lock);
/* Give time to concurrent readers. */
synchronize_net();
+
+ return 0;
}
EXPORT_SYMBOL(nf_log_unregister_pf);