netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
	Patrick McHardy <kaber@trash.net>,
	"David S. Miller" <davem@davemloft.net>,
	Jiri Kosina <jkosina@suse.cz>, Ilia Mirkin <imirkin@alum.mit.edu>,
	Sergey Popovich <popovich_sergei@mail.ru>,
	Joe Perches <joe@perches.com>,
	Anton Danilov <littlesmilingcloud@gmail.com>,
	stephen hemminger <stephen@networkplumber.org>,
	netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [patch] netfilter: ipset: off by one in ip_set_nfnl_get_byindex()
Date: Wed, 22 Oct 2014 14:11:25 +0200	[thread overview]
Message-ID: <20141022121125.GA25804@salvia> (raw)
In-Reply-To: <alpine.DEB.2.10.1410211146160.27469@blackhole.kfki.hu>

On Tue, Oct 21, 2014 at 11:51:12AM +0200, Jozsef Kadlecsik wrote:
> On Tue, 21 Oct 2014, Dan Carpenter wrote:
> 
> > The ->ip_set_list[] array is initialized in ip_set_net_init() and it
> > has ->ip_set_max elements so this check should be >= instead of >
> > otherwise we are off by one.
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> > I am not very familiar with this code, so please review cautiously.
> > This is an old bug which should go to -stable.
> > 
> > diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
> > index 912e5a0..86f9d76 100644
> > --- a/net/netfilter/ipset/ip_set_core.c
> > +++ b/net/netfilter/ipset/ip_set_core.c
> > @@ -659,7 +659,7 @@ ip_set_nfnl_get_byindex(struct net *net, ip_set_id_t index)
> >  	struct ip_set *set;
> >  	struct ip_set_net *inst = ip_set_pernet(net);
> >  
> > -	if (index > inst->ip_set_max)
> > +	if (index >= inst->ip_set_max)
> >  		return IPSET_INVALID_ID;
> >  
> >  	nfnl_lock(NFNL_SUBSYS_IPSET);
> > 
> 
> Absolutely right and it should go to stable too!
> 
> Acked-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>

Applied, thanks.

My script says this applies cleanly to:

3.14.x
3.16.x
3.17.x

So I'll enqueue this for those.

      reply	other threads:[~2014-10-22 12:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-21  8:28 [patch] netfilter: ipset: off by one in ip_set_nfnl_get_byindex() Dan Carpenter
2014-10-21  9:51 ` Jozsef Kadlecsik
2014-10-22 12:11   ` Pablo Neira Ayuso [this message]

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=20141022121125.GA25804@salvia \
    --to=pablo@netfilter.org \
    --cc=coreteam@netfilter.org \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=imirkin@alum.mit.edu \
    --cc=jkosina@suse.cz \
    --cc=joe@perches.com \
    --cc=kaber@trash.net \
    --cc=kadlec@blackhole.kfki.hu \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=littlesmilingcloud@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=popovich_sergei@mail.ru \
    --cc=stephen@networkplumber.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).