From: Jozsef Kadlecsik <kadlec@netfilter.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
Florian Westphal <fw@strlen.de>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] netfilter: ipset: fix uninitialized variable bug
Date: Wed, 4 Aug 2021 10:41:57 +0200 (CEST) [thread overview]
Message-ID: <a832cb21-1fe-62c-9ba8-f867488efade@netfilter.org> (raw)
In-Reply-To: <20210804083322.GB32730@kili>
Hi Dan,
On Wed, 4 Aug 2021, Dan Carpenter wrote:
> This condition doesn't work because "port_to" is not initialized until
> the next line. Move the condition down.
You are right - Nathan Chancellor already sent the same fix and I acked
it. Thanks!
Best regards,
Jozsef
> Fixes: 7fb6c63025ff ("netfilter: ipset: Limit the maximal range of consecutive elements to add/delete")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> net/netfilter/ipset/ip_set_hash_ipportnet.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/net/netfilter/ipset/ip_set_hash_ipportnet.c b/net/netfilter/ipset/ip_set_hash_ipportnet.c
> index b293aa1ff258..7df94f437f60 100644
> --- a/net/netfilter/ipset/ip_set_hash_ipportnet.c
> +++ b/net/netfilter/ipset/ip_set_hash_ipportnet.c
> @@ -246,9 +246,6 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[],
> ip_set_mask_from_to(ip, ip_to, cidr);
> }
>
> - if (((u64)ip_to - ip + 1)*(port_to - port + 1) > IPSET_MAX_RANGE)
> - return -ERANGE;
> -
> port_to = port = ntohs(e.port);
> if (tb[IPSET_ATTR_PORT_TO]) {
> port_to = ip_set_get_h16(tb[IPSET_ATTR_PORT_TO]);
> @@ -256,6 +253,9 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[],
> swap(port, port_to);
> }
>
> + if (((u64)ip_to - ip + 1)*(port_to - port + 1) > IPSET_MAX_RANGE)
> + return -ERANGE;
> +
> ip2_to = ip2_from;
> if (tb[IPSET_ATTR_IP2_TO]) {
> ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP2_TO], &ip2_to);
> --
> 2.20.1
>
>
-
E-mail : kadlec@blackhole.kfki.hu, kadlecsik.jozsef@wigner.hu
PGP key : https://wigner.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics
H-1525 Budapest 114, POB. 49, Hungary
prev parent reply other threads:[~2021-08-04 8:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-04 8:33 [PATCH] netfilter: ipset: fix uninitialized variable bug Dan Carpenter
2021-08-04 8:41 ` Jozsef Kadlecsik [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=a832cb21-1fe-62c-9ba8-f867488efade@netfilter.org \
--to=kadlec@netfilter.org \
--cc=coreteam@netfilter.org \
--cc=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=fw@strlen.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.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).