diff options
author | Harald Welte <laforge@netfilter.org> | 2005-08-09 23:23:53 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2005-08-29 18:51:25 -0400 |
commit | 8a61fadb3908454ccfa538aaa75eb1d22def5700 (patch) | |
tree | e3e2b131c03b3cab2f81e6cdeeaadf50071046b9 | |
parent | d72367b6f36e557f122beefaa8c6b80eb1c7f245 (diff) |
[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>
-rw-r--r-- | include/linux/netfilter.h | 2 | ||||
-rw-r--r-- | 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 index bf430fcbe364..ac3c61411d4b 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h | |||
@@ -157,7 +157,7 @@ struct nf_logger { | |||
157 | 157 | ||
158 | /* Function to register/unregister log function. */ | 158 | /* Function to register/unregister log function. */ |
159 | int nf_log_register(int pf, struct nf_logger *logger); | 159 | int nf_log_register(int pf, struct nf_logger *logger); |
160 | void nf_log_unregister_pf(int pf); | 160 | int nf_log_unregister_pf(int pf); |
161 | void nf_log_unregister_logger(struct nf_logger *logger); | 161 | void nf_log_unregister_logger(struct nf_logger *logger); |
162 | 162 | ||
163 | /* Calls the registered backend logging function */ | 163 | /* Calls the registered backend logging function */ |
diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c index e104760f7a67..573e76a770d9 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) | |||
24 | { | 24 | { |
25 | int ret = -EBUSY; | 25 | int ret = -EBUSY; |
26 | 26 | ||
27 | if (pf >= NPROTO) | ||
28 | return -EINVAL; | ||
29 | |||
27 | /* Any setup of logging members must be done before | 30 | /* Any setup of logging members must be done before |
28 | * substituting pointer. */ | 31 | * substituting pointer. */ |
29 | spin_lock(&nf_log_lock); | 32 | spin_lock(&nf_log_lock); |
@@ -38,14 +41,19 @@ int nf_log_register(int pf, struct nf_logger *logger) | |||
38 | } | 41 | } |
39 | EXPORT_SYMBOL(nf_log_register); | 42 | EXPORT_SYMBOL(nf_log_register); |
40 | 43 | ||
41 | void nf_log_unregister_pf(int pf) | 44 | int nf_log_unregister_pf(int pf) |
42 | { | 45 | { |
46 | if (pf >= NPROTO) | ||
47 | return -EINVAL; | ||
48 | |||
43 | spin_lock(&nf_log_lock); | 49 | spin_lock(&nf_log_lock); |
44 | nf_logging[pf] = NULL; | 50 | nf_logging[pf] = NULL; |
45 | spin_unlock(&nf_log_lock); | 51 | spin_unlock(&nf_log_lock); |
46 | 52 | ||
47 | /* Give time to concurrent readers. */ | 53 | /* Give time to concurrent readers. */ |
48 | synchronize_net(); | 54 | synchronize_net(); |
55 | |||
56 | return 0; | ||
49 | } | 57 | } |
50 | EXPORT_SYMBOL(nf_log_unregister_pf); | 58 | EXPORT_SYMBOL(nf_log_unregister_pf); |
51 | 59 | ||