Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 2514

kernel-2.6.18-238.el5.src.rpm

From: Wade Mealing <wmealing@redhat.com>
Date: Wed, 21 Jul 2010 05:46:13 -0400
Subject: [net] clusterip: check allocation before freeing memory
Message-id: <1279691174-15801-2-git-send-email-wmealing@redhat.com>
Patchwork-id: 26985
O-Subject: [PATCH 1/2] [RHEL 5.6] BZ 615227 Netfilter clusterip - check
	allocation correct before freeing memory.
Bugzilla: 615227
RH-Acked-by: David S. Miller <davem@redhat.com>
RH-Acked-by: Jiri Olsa <jolsa@redhat.com>
RH-Acked-by: Jiri Pirko <jpirko@redhat.com>

Red Hat Bugzilla: 615227
Upstream Commit:  902a3dd5e6b19048604ec533203d7d38a39505a2

This is a backport of Eric Dumazets patch to fix netfilter when attempting
to free an allocation which may have never been allocated.

diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index 5881e83..ffc7309d 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -620,7 +620,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)