netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] netfilter: Don't leak 'exp' in ctnetlink_create_expect()
@ 2012-12-26 21:49 Jesper Juhl
  2012-12-26 22:09 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Jesper Juhl @ 2012-12-26 21:49 UTC (permalink / raw)
  To: netfilter
  Cc: linux-kernel, netdev, coreteam, netfilter-devel, David S. Miller,
	Patrick McHardy, Pablo Neira Ayuso, Jay Schulist, Harald Welte

'if ((!help) && (!cda[CTA_EXPECT_TIMEOUT]))' then we should remember
to free 'exp' that was allocated by 'nf_ct_expect_alloc()' by jumping
to the 'err_out' label rather than the 'out' label in
ctnetlink_create_expect().
This patch should get rid of the leak.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 net/netfilter/nf_conntrack_netlink.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

 note: compile tested only.

diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 4e078cd..627b0e5 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -2624,7 +2624,7 @@ ctnetlink_create_expect(struct net *net, u16 zone,
 	if (!help) {
 		if (!cda[CTA_EXPECT_TIMEOUT]) {
 			err = -EINVAL;
-			goto out;
+			goto err_out;
 		}
 		exp->timeout.expires =
 		  jiffies + ntohl(nla_get_be32(cda[CTA_EXPECT_TIMEOUT])) * HZ;
-- 
1.7.1


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] netfilter: Don't leak 'exp' in ctnetlink_create_expect()
  2012-12-26 21:49 [PATCH] netfilter: Don't leak 'exp' in ctnetlink_create_expect() Jesper Juhl
@ 2012-12-26 22:09 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2012-12-26 22:09 UTC (permalink / raw)
  To: Jesper Juhl
  Cc: netfilter, linux-kernel, netdev, coreteam, netfilter-devel,
	David S. Miller, Patrick McHardy, Jay Schulist, Harald Welte

On Wed, Dec 26, 2012 at 10:49:40PM +0100, Jesper Juhl wrote:
> 'if ((!help) && (!cda[CTA_EXPECT_TIMEOUT]))' then we should remember
> to free 'exp' that was allocated by 'nf_ct_expect_alloc()' by jumping
> to the 'err_out' label rather than the 'out' label in
> ctnetlink_create_expect().
> This patch should get rid of the leak.

Applied, thanks Jesper.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-12-26 22:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-26 21:49 [PATCH] netfilter: Don't leak 'exp' in ctnetlink_create_expect() Jesper Juhl
2012-12-26 22:09 ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).