From: Dan Carpenter <dan.carpenter@oracle.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Patrick McHardy <kaber@trash.net>,
Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>,
"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: [patch] netfilter: ipset: off by one in ip_set_nfnl_get_byindex()
Date: Tue, 21 Oct 2014 08:28:12 +0000 [thread overview]
Message-ID: <20141021082812.GB28426@mwanda> (raw)
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);
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Patrick McHardy <kaber@trash.net>,
Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>,
"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: [patch] netfilter: ipset: off by one in ip_set_nfnl_get_byindex()
Date: Tue, 21 Oct 2014 11:28:12 +0300 [thread overview]
Message-ID: <20141021082812.GB28426@mwanda> (raw)
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);
next reply other threads:[~2014-10-21 8:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-21 8:28 Dan Carpenter [this message]
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-21 9:51 ` Jozsef Kadlecsik
2014-10-22 12:11 ` Pablo Neira Ayuso
2014-10-22 12:11 ` Pablo Neira Ayuso
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=20141021082812.GB28426@mwanda \
--to=dan.carpenter@oracle.com \
--cc=coreteam@netfilter.org \
--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=pablo@netfilter.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 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.