Netdev List
 help / color / mirror / Atom feed
* [PATCH] nf_log: check function arguments
@ 2005-08-08 17:04 Harald Welte
  2005-08-09  0:02 ` David S. Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Harald Welte @ 2005-08-08 17:04 UTC (permalink / raw)
  To: David Miller; +Cc: Linux Netdev List, Netfilter Development Mailinglist


[-- Attachment #1.1: Type: text/plain, Size: 522 bytes --]

Hi Dave!

Please apply to your net-2.6.14, thanks

Ok, this will be my last patch for some time, I promise.  Guess you must
be bored by now...

-- 
- Harald Welte <laforge@netfilter.org>                 http://netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie

[-- Attachment #1.2: 40-nf_log-nproto-check.patch --]
[-- Type: text/plain, Size: 1903 bytes --]

[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>

---
commit 041cf7f2c1158ae8e9b6d8173b77cbcc878cb54c
tree dd3f91ef47ed9867f4baaaa240161f9ee2210d3c
parent 2f20e47c7aaf09749b1bb0684fbd30a1921d2de2
author Harald Welte <laforge@netfilter.org> Mo, 08 Aug 2005 19:02:07 +0200
committer Harald Welte <laforge@netfilter.org> Mo, 08 Aug 2005 19:02:07 +0200

 include/linux/netfilter.h |    2 +-
 net/netfilter/nf_log.c    |   10 +++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -157,7 +157,7 @@ struct nf_logger {
 
 /* Function to register/unregister log function. */
 int nf_log_register(int pf, struct nf_logger *logger);
-void nf_log_unregister_pf(int pf);
+int nf_log_unregister_pf(int pf);
 void nf_log_unregister_logger(struct nf_logger *logger);
 
 /* Calls the registered backend logging function */
diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c
--- a/net/netfilter/nf_log.c
+++ b/net/netfilter/nf_log.c
@@ -23,6 +23,9 @@ int nf_log_register(int pf, struct nf_lo
 {
 	int ret = -EBUSY;
 
+	if (pf >= NPROTO)
+		return -EINVAL;
+
 	/* Any setup of logging members must be done before
 	 * substituting pointer. */
 	spin_lock(&nf_log_lock);
@@ -37,14 +40,19 @@ int nf_log_register(int pf, struct nf_lo
 }		
 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);
 

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

end of thread, other threads:[~2005-08-09  0:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-08 17:04 [PATCH] nf_log: check function arguments Harald Welte
2005-08-09  0:02 ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox