Skip to contentSkip to conversation

: Netfilter -stable fixes

PATCH New Patrick McHardy 1 participant 3 messages Jan 15, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover : Netfilter -stable fixes

The following two patches for ctnetlink fix a crash when the CTA_STATUS attribute is not present and a memory leak when changing the conntrack protocol data fails.

Please apply, thanks.

 net/ipv4/netfilter/ip_conntrack_netlink.c |   10 ++++++----
 net/netfilter/nf_conntrack_netlink.c      |   10 ++++++----
 2 files changed, 12 insertions(+), 8 deletions(-)

Pablo Neira Ayuso:
[NETFILTER]: ctnetlink: check for status attribute existence on conntrack creation

Patrick McHardy:
[NETFILTER]: ctnetlink: fix leak in ctnetlink_create_conntrack error path

#1 lore raw

PATCH 1/2 : ctnetlink: check for status attribute existence on conntrack creation

[NETFILTER]: ctnetlink: check for status attribute existence on conntrack creation

Check that status flags are available in the netlink message received to create a new conntrack.

Fixes a crash in ctnetlink_create_conntrack when the CTA_STATUS attribute is not present.

---
commit 667fca411a3edaf30f98f3f7aaf0c1be8d0e7cc2
tree 0a0026ce63097bcb1c7bf6780cd89a21395b67ca
parent 3ac4e26b2cc43180661453851174f40a1292da09
author Pablo Neira Ayuso <[email protected]> Mon, 15 Jan 2007 10:16:22 +0100 committer Patrick McHardy <[email protected]> Mon, 15 Jan 2007 10:16:22 +0100

 net/ipv4/netfilter/ip_conntrack_netlink.c |    8 +++++---
 net/netfilter/nf_conntrack_netlink.c      |    8 +++++---
 2 files changed, 10 insertions(+), 6 deletions(-)
net/ipv4/netfilter/ip_conntrack_netlink.c +5 -3
index 55f0ae6..39f23f4 100644
@@ -946,9 +946,11 @@ ctnetlink_create_conntrack(struct nfattr
 	ct->timeout.expires = jiffies + ct->timeout.expires * HZ;
 	ct->status |= IPS_CONFIRMED;
 
-	err = ctnetlink_change_status(ct, cda);
-	if (err < 0)
-		goto err;
+	if (cda[CTA_STATUS-1]) {
+		err = ctnetlink_change_status(ct, cda);
+		if (err < 0)
+			goto err;
+	}
 
 	if (cda[CTA_PROTOINFO-1]) {
 		err = ctnetlink_change_protoinfo(ct, cda);
net/netfilter/nf_conntrack_netlink.c +5 -3
index ab67c2b..c650ccc 100644
@@ -963,9 +963,11 @@ ctnetlink_create_conntrack(struct nfattr
 	ct->timeout.expires = jiffies + ct->timeout.expires * HZ;
 	ct->status |= IPS_CONFIRMED;
 
-	err = ctnetlink_change_status(ct, cda);
-	if (err < 0)
-		goto err;
+	if (cda[CTA_STATUS-1]) {
+		err = ctnetlink_change_status(ct, cda);
+		if (err < 0)
+			goto err;
+	}
 
 	if (cda[CTA_PROTOINFO-1]) {
 		err = ctnetlink_change_protoinfo(ct, cda);
#2 lore raw

PATCH 2/2 : ctnetlink: fix leak in ctnetlink_create_conntrack error path

In reply to Patrick McHardy

[NETFILTER]: ctnetlink: fix leak in ctnetlink_create_conntrack error path

---
commit b653efffdc1e260fbb446298fd3fa231f4193cdf
tree a36dd3e3a47b2dc02efb2eea9a98fc63b41260f9
parent 667fca411a3edaf30f98f3f7aaf0c1be8d0e7cc2
author Patrick McHardy <[email protected]> Mon, 15 Jan 2007 10:16:35 +0100 committer Patrick McHardy <[email protected]> Mon, 15 Jan 2007 10:16:35 +0100

 net/ipv4/netfilter/ip_conntrack_netlink.c |    2 +-
 net/netfilter/nf_conntrack_netlink.c      |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
net/ipv4/netfilter/ip_conntrack_netlink.c +1 -1
index 39f23f4..424f2fc 100644
@@ -955,7 +955,7 @@ ctnetlink_create_conntrack(struct nfattr
 	if (cda[CTA_PROTOINFO-1]) {
 		err = ctnetlink_change_protoinfo(ct, cda);
 		if (err < 0)
-			return err;
+			goto err;
 	}
 
 #if defined(CONFIG_IP_NF_CONNTRACK_MARK)
net/netfilter/nf_conntrack_netlink.c +1 -1
index c650ccc..4c2e69a 100644
@@ -972,7 +972,7 @@ ctnetlink_create_conntrack(struct nfattr
 	if (cda[CTA_PROTOINFO-1]) {
 		err = ctnetlink_change_protoinfo(ct, cda);
 		if (err < 0)
-			return err;
+			goto err;
 	}
 
 #if defined(CONFIG_NF_CONNTRACK_MARK)