All of lore.kernel.org
 help / color / mirror / Atom feed
From: Loganaden Velvindron <logan@elandsys.com>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH 1/1 net-next] net: bridge: netfilter: use vzalloc() instead of vmalloc() for counterstmp
Date: Fri, 30 Oct 2015 05:33:03 -0700	[thread overview]
Message-ID: <20151030123303.GA19481@mx.elandsys.com> (raw)

counterstmp is not cleared before it is used in get_counters(). it might be 
leaked partially when it is sent to userland later on.

Signed-off-by: Loganaden Velvindron <logan@elandsys.com>
---
 net/bridge/netfilter/ebtables.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index f46ca41..26922e9 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -989,7 +989,7 @@ static int do_replace_finish(struct net *net, struct ebt_replace *repl,
 	   the check on the size is done later, when we have the lock */
 	if (repl->num_counters) {
 		unsigned long size = repl->num_counters * sizeof(*counterstmp);
-		counterstmp = vmalloc(size);
+		counterstmp = vzalloc(size);
 		if (!counterstmp)
 			return -ENOMEM;
 	}
@@ -1410,7 +1410,7 @@ static int copy_counters_to_user(struct ebt_table *t,
 		return -EINVAL;
 	}
 
-	counterstmp = vmalloc(nentries * sizeof(*counterstmp));
+	counterstmp = vzalloc(nentries * sizeof(*counterstmp));
 	if (!counterstmp)
 		return -ENOMEM;
 
-- 
2.6.1

             reply	other threads:[~2015-10-30 13:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-30 12:33 Loganaden Velvindron [this message]
2015-11-08 20:41 ` [PATCH 1/1 net-next] net: bridge: netfilter: use vzalloc() instead of vmalloc() for counterstmp Pablo Neira Ayuso
2015-11-08 20:52   ` Loganaden Velvindron
2015-11-08 21:30     ` Pablo Neira Ayuso
2015-11-08 21:26       ` Loganaden Velvindron

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=20151030123303.GA19481@mx.elandsys.com \
    --to=logan@elandsys.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.