summaryrefslogtreecommitdiffstats
path: root/net/ipv4/netfilter/ip_conntrack_ftp.c
diff options
context:
space:
mode:
authorHarald Welte2005-08-10 05:19:44 +0200
committerDavid S. Miller2005-08-30 00:50:57 +0200
commit2669d63d20683828f673b606915957f3a070602d (patch)
tree7e8ab15a956035e63b22237ffdd6d0101b391589 /net/ipv4/netfilter/ip_conntrack_ftp.c
parent[INET]: Make inet_create try to load protocol modules (diff)
downloadkernel-qcow2-linux-2669d63d20683828f673b606915957f3a070602d.tar.gz
kernel-qcow2-linux-2669d63d20683828f673b606915957f3a070602d.tar.xz
kernel-qcow2-linux-2669d63d20683828f673b606915957f3a070602d.zip
[NETFILTER]: move conntrack helper buffers from BSS to kmalloc()ed memory
According to DaveM, it is preferrable to have large data structures be allocated dynamically from the module init() function rather than putting them as static global variables into BSS. This patch moves the conntrack helper packet buffers into dynamically allocated memory. Signed-off-by: Harald Welte <laforge@netfilter.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/netfilter/ip_conntrack_ftp.c')
-rw-r--r--net/ipv4/netfilter/ip_conntrack_ftp.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/net/ipv4/netfilter/ip_conntrack_ftp.c b/net/ipv4/netfilter/ip_conntrack_ftp.c
index 9658896f899a..3a2627db1729 100644
--- a/net/ipv4/netfilter/ip_conntrack_ftp.c
+++ b/net/ipv4/netfilter/ip_conntrack_ftp.c
@@ -25,8 +25,7 @@ MODULE_AUTHOR("Rusty Russell <rusty@rustcorp.com.au>");
MODULE_DESCRIPTION("ftp connection tracking helper");
/* This is slow, but it's simple. --RR */
-static char ftp_buffer[65536];
-
+static char *ftp_buffer;
static DEFINE_SPINLOCK(ip_ftp_lock);
#define MAX_PORTS 8
@@ -461,6 +460,8 @@ static void fini(void)
ports[i]);
ip_conntrack_helper_unregister(&ftp[i]);
}
+
+ kfree(ftp_buffer);
}
static int __init init(void)
@@ -468,6 +469,10 @@ static int __init init(void)
int i, ret;
char *tmpname;
+ ftp_buffer = kmalloc(65536, GFP_KERNEL);
+ if (!ftp_buffer)
+ return -ENOMEM;
+
if (ports_c == 0)
ports[ports_c++] = FTP_PORT;