netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Loganaden Velvindron <loganaden@gmail.com>
Cc: Loganaden Velvindron <logan@elandsys.com>,
	netfilter-devel@vger.kernel.org
Subject: Re: [PATCH 1/1 net-next] net: bridge: netfilter: use vzalloc() instead of vmalloc() for counterstmp
Date: Sun, 8 Nov 2015 22:30:45 +0100	[thread overview]
Message-ID: <20151108213045.GA4259@salvia> (raw)
In-Reply-To: <CAOp4FwTa91=dHkWmSz7QzojwbTEo97P1HRXqt7EN=FAKgC1Eaw@mail.gmail.com>

On Sun, Nov 08, 2015 at 08:52:50PM +0000, Loganaden Velvindron wrote:
> On Sun, Nov 8, 2015 at 8:41 PM, Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> > On Fri, Oct 30, 2015 at 05:33:03AM -0700, Loganaden Velvindron wrote:
> >> counterstmp is not cleared before it is used in get_counters(). it might be
> >> leaked partially when it is sent to userland later on.
> >
> > get_counters() is memcpy'ing the old counter to the counterstmp area
> > and updating it.
> >
> > Where is there leak?
> >
> 
> In this case, none, due to correct memcpy parameters in get_counters().
> 
> However, as this is exposed later on to userland through:
> 
>         if (copy_to_user(user, counterstmp,
>            nentries * sizeof(struct ebt_counter)))
> 
> zero'ing counterstmp malloc'ed memory, looks like a good idea.

We allocate room for nentries, then we get_counters() those nentries
that memcpy that area, and we copy back to user nentries.

Where is the problem?

  reply	other threads:[~2015-11-08 21:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-30 12:33 [PATCH 1/1 net-next] net: bridge: netfilter: use vzalloc() instead of vmalloc() for counterstmp Loganaden Velvindron
2015-11-08 20:41 ` Pablo Neira Ayuso
2015-11-08 20:52   ` Loganaden Velvindron
2015-11-08 21:30     ` Pablo Neira Ayuso [this message]
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=20151108213045.GA4259@salvia \
    --to=pablo@netfilter.org \
    --cc=logan@elandsys.com \
    --cc=loganaden@gmail.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 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).