Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Patrick McHardy <kaber@trash.net>
Cc: netfilter-devel@vger.kernel.org, netdev@vger.kernel.org,
	David Miller <davem@davemloft.net>
Subject: [PATCH] netfilter: CLUSTERIP: clusterip_seq_stop() fix
Date: Thu, 25 Mar 2010 20:47:22 +0100	[thread overview]
Message-ID: <1269546442.2894.5.camel@edumazet-laptop> (raw)
In-Reply-To: <1269539686-3885-3-git-send-email-kaber@trash.net>

If clusterip_seq_start() memory allocation fails, we crash later in
clusterip_seq_start(), trying to kfree(ERR_PTR(-ENOMEM))

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index 0886f96..afa937b 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -600,7 +600,8 @@ static void *clusterip_seq_next(struct seq_file *s, void *v, loff_t *pos)
 
 static void clusterip_seq_stop(struct seq_file *s, void *v)
 {
-	kfree(v);
+	if (!IS_ERR(v))
+		kfree(v);
 }
 
 static int clusterip_seq_show(struct seq_file *s, void *v)



  parent reply	other threads:[~2010-03-25 19:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-25 17:54 [PATCH 0/4] netfilter fixes kaber
2010-03-25 17:54 ` [PATCH 1/4] netfilter: xt_recent: fix regression in rules using a zero hit_count kaber
2010-03-25 17:54   ` [PATCH 2/4] netfilter: xt_hashlimit: dl_seq_stop() fix kaber
2010-03-25 17:54     ` [PATCH 3/4] netfilter: ip6table_raw: fix table priority kaber
2010-03-25 17:54       ` [PATCH 4/4] netfilter: xt_hashlimit: IPV6 bugfix kaber
2010-03-25 19:47     ` Eric Dumazet [this message]
2010-04-01 10:54       ` [PATCH] netfilter: CLUSTERIP: clusterip_seq_stop() fix Patrick McHardy
2010-03-25 18:49 ` [PATCH 0/4] netfilter fixes David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1269546442.2894.5.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kaber@trash.net \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox