: Fix memory leak in ipt_recent
Subsystems (2)
PATCH 1/2 : Fix memory leak in ipt_recent
Hi Dave,
following are two small netfilter fixes for 2.6.17. Please apply, thanks.
net/bridge/netfilter/ebt_log.c | 2 +- net/ipv4/netfilter/ipt_LOG.c | 2 +- net/ipv4/netfilter/ipt_recent.c | 2 +- net/ipv6/netfilter/ip6t_LOG.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
Jesper Juhl:
[NETFILTER]: Fix memory leak in ipt_recent
Philip Craig:
[NETFILTER]: fix format specifier for netfilter log targets
[NETFILTER]: Fix memory leak in ipt_recent
The Coverity checker spotted that we may leak 'hold' in net/ipv4/netfilter/ipt_recent.c::checkentry() when the following is true:
if (!curr_table->status_proc) {
...
if(!curr_table) {
...
return 0; <-- here we leak.Simply moving an existing vfree(hold); up a bit avoids the possible leak.
---
commit 6bf69b5660fafbbb8bfeebcfd53efee8ab419ff1
tree c7ac73a113253a66fe54ed1c3689666683a07374
parent 0c056c50a6218e0e577817c16ba8851af593d742
author Jesper Juhl <[email protected]> Wed, 17 May 2006 09:36:23 +0200 committer Patrick McHardy <[email protected]> Wed, 17 May 2006 09:36:23 +0200
net/ipv4/netfilter/ipt_recent.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/ipv4/netfilter/ipt_recent.c +1 -1
@@ -821,6 +821,7 @@ #ifdef CONFIG_PROC_FS/* Create our proc 'status' entry. */ curr_table->status_proc =create_proc_entry (curr_table->name, ip_list_perms, proc_net_ipt_recent);if (!curr_table->status_proc) { +vfree (hold); printk(KERN_INFO RECENT_NAME ": checkentry: unable to allocate for /proc entry.\n");/* Destroy the created table */ spin_lock_bh (&recent_lock);
@@ -845,7 +846,6 @@ #endifspin_unlock_bh (&recent_lock);vfree (curr_table->time_info);vfree (curr_table->hash_table); -vfree (hold);vfree (curr_table->table);vfree (curr_table);return 0 ;