Netdev List
 help / color / mirror / Atom feed
From: Nikolay Aleksandrov <razor@blackwall.org>
To: Ruoyu Wang <ruoyuw560@gmail.com>,
	Ido Schimmel <idosch@nvidia.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>
Cc: bridge@lists.linux.dev, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net: bridge: Reject descending VLAN tunnel ranges
Date: Sun, 16 Aug 2026 10:33:09 +0300	[thread overview]
Message-ID: <0d917407-feaf-41c6-af7f-080aced09bf3@blackwall.org> (raw)
In-Reply-To: <20260814134053.1387275-1-ruoyuw560@gmail.com>

On 14/08/2026 16:40, Ruoyu Wang wrote:
> A pair of descending VLAN and tunnel IDs can pass the tunnel range span
> check. The VLAN subtraction produces a negative int, which is converted
> to unsigned when compared with the u32 tunnel ID subtraction. It can
> therefore equal the wrapped tunnel ID delta.
> 
> The range loop then performs no iterations. Since the batched
> notification handling added a post-loop error check, this leaves err
> uninitialized and makes the request's return value unpredictable.
> 
> Reject descending VLAN ranges before comparing the spans. Valid
> ascending and single-entry ranges remain unchanged, while malformed
> descending ranges consistently return -EINVAL.
> 
> This issue was found by a static analysis checker and confirmed by
> manual source review.
> 
> Fixes: 94339443686b ("net: bridge: notify on vlan tunnel changes done via the old api")
> Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
> ---
>   net/bridge/br_netlink_tunnel.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/net/bridge/br_netlink_tunnel.c b/net/bridge/br_netlink_tunnel.c
> index 71a12da30004c..05f560eeb789c 100644
> --- a/net/bridge/br_netlink_tunnel.c
> +++ b/net/bridge/br_netlink_tunnel.c
> @@ -301,7 +301,8 @@ int br_process_vlan_tunnel_info(const struct net_bridge *br,
>   
>   		if (!(tinfo_last->flags & BRIDGE_VLAN_INFO_RANGE_BEGIN))
>   			return -EINVAL;
> -		if ((tinfo_curr->vid - tinfo_last->vid) !=
> +		if (tinfo_curr->vid < tinfo_last->vid ||
> +		    (tinfo_curr->vid - tinfo_last->vid) !=
>   		    (tinfo_curr->tunid - tinfo_last->tunid))
>   			return -EINVAL;
>   		t = tinfo_last->tunid;

Acked-by: Nikolay Aleksandrov <razor@blackwall.org>

      reply	other threads:[~2026-08-16  7:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-14 13:40 [PATCH net] net: bridge: Reject descending VLAN tunnel ranges Ruoyu Wang
2026-08-16  7:33 ` Nikolay Aleksandrov [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=0d917407-feaf-41c6-af7f-080aced09bf3@blackwall.org \
    --to=razor@blackwall.org \
    --cc=bridge@lists.linux.dev \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ruoyuw560@gmail.com \
    /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