[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZAYN6TguobKt6Mrx@corigine.com>
Date: Mon, 6 Mar 2023 16:59:37 +0100
From: Simon Horman <simon.horman@...igine.com>
To: Xin Long <lucien.xin@...il.com>
Cc: netfilter-devel@...r.kernel.org,
network dev <netdev@...r.kernel.org>,
Pablo Neira Ayuso <pablo@...filter.org>,
Jozsef Kadlecsik <kadlec@...filter.org>,
Florian Westphal <fw@...len.de>, davem@...emloft.net,
kuba@...nel.org, Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>,
Roopa Prabhu <roopa@...dia.com>,
Nikolay Aleksandrov <razor@...ckwall.org>,
Pravin B Shelar <pshelar@....org>,
Aaron Conole <aconole@...hat.com>
Subject: Re: [PATCH nf-next 2/6] netfilter: bridge: check len before
accessing more nh data
On Fri, Mar 03, 2023 at 07:12:38PM -0500, Xin Long wrote:
> In the while loop of br_nf_check_hbh_len(), similar to ip6_parse_tlv(),
> before accessing 'nh[off + 1]', it should add a check 'len < 2'; and
> before parsing IPV6_TLV_JUMBO, it should add a check 'optlen > len',
> in case of overflows.
>
> Signed-off-by: Xin Long <lucien.xin@...il.com>
Reviewed-by: Simon Horman <simon.horman@...igine.com>
> ---
> net/bridge/br_netfilter_ipv6.c | 47 ++++++++++++++++------------------
> 1 file changed, 22 insertions(+), 25 deletions(-)
>
> diff --git a/net/bridge/br_netfilter_ipv6.c b/net/bridge/br_netfilter_ipv6.c
> index 5cd3e4c35123..50f564c33551 100644
> --- a/net/bridge/br_netfilter_ipv6.c
> +++ b/net/bridge/br_netfilter_ipv6.c
...
> - if (len == 0)
> - return 0;
> -bad:
> - return -1;
> + if (len)
> + return -1;
> +
> + return 0;
nit: if you have to spin a v2, you may want to consider
return len ? -1 : 0;
Powered by blists - more mailing lists