X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=net%2Fnetfilter%2Fnf_log.c;h=3e76bd0824a25b7c31e60ea4a5d59e27745f12fc;hb=a57ebc90f1350296edded12d33d7c278831bc3bf;hp=e104760f7a67702be2636d07c90a0b5170166d32;hpb=d72367b6f36e557f122beefaa8c6b80eb1c7f245;p=linux-2.6 diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c index e104760f7a..3e76bd0824 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); @@ -159,12 +167,12 @@ int __init netfilter_log_init(void) { #ifdef CONFIG_PROC_FS struct proc_dir_entry *pde; + pde = create_proc_entry("nf_log", S_IRUGO, proc_net_netfilter); -#endif if (!pde) return -1; pde->proc_fops = &nflog_file_ops; - +#endif return 0; }