All of lore.kernel.org
 help / color / mirror / Atom feed
* [NETFILTER 1/2]: Fix memory leak in ipt_recent
@ 2006-05-17  7:40 Patrick McHardy
  0 siblings, 0 replies; only message in thread
From: Patrick McHardy @ 2006-05-17  7:40 UTC (permalink / raw)
  To: David S. Miller; +Cc: Netfilter Development Mailinglist

[-- Attachment #1: Type: text/plain, Size: 452 bytes --]

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

[-- Attachment #2: 01.diff --]
[-- Type: text/plain, Size: 1628 bytes --]

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

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>

---
commit 6bf69b5660fafbbb8bfeebcfd53efee8ab419ff1
tree c7ac73a113253a66fe54ed1c3689666683a07374
parent 0c056c50a6218e0e577817c16ba8851af593d742
author Jesper Juhl <jesper.juhl@gmail.com> Wed, 17 May 2006 09:36:23 +0200
committer Patrick McHardy <kaber@trash.net> Wed, 17 May 2006 09:36:23 +0200

 net/ipv4/netfilter/ipt_recent.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/ipv4/netfilter/ipt_recent.c b/net/ipv4/netfilter/ipt_recent.c
index 1438432..b847ee4 100644
--- a/net/ipv4/netfilter/ipt_recent.c
+++ b/net/ipv4/netfilter/ipt_recent.c
@@ -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 @@ #endif
 		spin_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;

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2006-05-17  7:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-17  7:40 [NETFILTER 1/2]: Fix memory leak in ipt_recent Patrick McHardy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.