netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH 1/6] netfilter: nfnetlink_acct: Fix memory leak
Date: Thu,  5 Jun 2014 17:08:21 +0200	[thread overview]
Message-ID: <1401980906-25290-2-git-send-email-pablo@netfilter.org> (raw)
In-Reply-To: <1401980906-25290-1-git-send-email-pablo@netfilter.org>

From: Mathieu Poirier <mathieu.poirier@linaro.org>

Allocation of memory need only to happen once, that is
after the proper checks on the NFACCT_FLAGS have been
done.  Otherwise the code can return without freeing
already allocated memory.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nfnetlink_acct.c |    1 -
 1 file changed, 1 deletion(-)

diff --git a/net/netfilter/nfnetlink_acct.c b/net/netfilter/nfnetlink_acct.c
index 70e86bb..54af985 100644
--- a/net/netfilter/nfnetlink_acct.c
+++ b/net/netfilter/nfnetlink_acct.c
@@ -83,7 +83,6 @@ nfnl_acct_new(struct sock *nfnl, struct sk_buff *skb,
 		return -EBUSY;
 	}
 
-	nfacct = kzalloc(sizeof(struct nf_acct), GFP_KERNEL);
 	if (tb[NFACCT_FLAGS]) {
 		flags = ntohl(nla_get_be32(tb[NFACCT_FLAGS]));
 		if (flags & ~NFACCT_F_QUOTA)
-- 
1.7.10.4

  reply	other threads:[~2014-06-05 15:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-05 15:08 [PATCH 0/6] Netfilter/nf_tables fixes for net-next Pablo Neira Ayuso
2014-06-05 15:08 ` Pablo Neira Ayuso [this message]
2014-06-05 15:08 ` [PATCH 2/6] netfilter: nf_tables: fix wrong transaction ordering in set elements Pablo Neira Ayuso
2014-06-05 15:08 ` [PATCH 3/6] netfilter: nf_tables: release objects in reverse order in the abort path Pablo Neira Ayuso
2014-06-05 15:08 ` [PATCH 4/6] netfilter: nft_rbtree: introduce locking Pablo Neira Ayuso
2014-06-05 15:08 ` [PATCH 5/6] netfilter: nf_tables: allow to delete several objects from a batch Pablo Neira Ayuso
2014-06-05 15:08 ` [PATCH 6/6] netfilter: nf_tables: atomic allocation in set notifications from rcu callback Pablo Neira Ayuso
2014-06-05 22:35 ` [PATCH 0/6] Netfilter/nf_tables fixes for net-next 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=1401980906-25290-2-git-send-email-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.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;
as well as URLs for NNTP newsgroup(s).