[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <98560fc9-ca90-4c64-980a-472e49a77a13@bootlin.com>
Date: Thu, 13 Nov 2025 12:48:37 +0100
From: Maxime Chevallier <maxime.chevallier@...tlin.com>
To: Ovidiu Panait <ovidiu.panait.rb@...esas.com>, andrew+netdev@...n.ch,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, mcoquelin.stm32@...il.com, alexandre.torgue@...s.st.com,
rmk+kernel@...linux.org.uk, boon.khai.ng@...era.com
Cc: netdev@...r.kernel.org, linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v2 1/2] net: stmmac: Fix VLAN 0 deletion in
vlan_del_hw_rx_fltr()
On 13/11/2025 12:27, Ovidiu Panait wrote:
> When the "rx-vlan-filter" feature is enabled on a network device, the 8021q
> module automatically adds a VLAN 0 hardware filter when the device is
> brought administratively up.
>
> For stmmac, this causes vlan_add_hw_rx_fltr() to create a new entry for
> VID 0 in the mac_device_info->vlan_filter array, in the following format:
>
> VLAN_TAG_DATA_ETV | VLAN_TAG_DATA_VEN | vid
>
> Here, VLAN_TAG_DATA_VEN indicates that the hardware filter is enabled for
> that VID.
>
> However, on the delete path, vlan_del_hw_rx_fltr() searches the vlan_filter
> array by VID only, without verifying whether a VLAN entry is enabled. As a
> result, when the 8021q module attempts to remove VLAN 0, the function may
> mistakenly match a zero-initialized slot rather than the actual VLAN 0
> entry, causing incorrect deletions and leaving stale entries in the
> hardware table.
>
> Fix this by verifying that the VLAN entry's enable bit (VLAN_TAG_DATA_VEN)
> is set before matching and deleting by VID. This ensures only active VLAN
> entries are removed and avoids leaving stale entries in the VLAN filter
> table, particularly for VLAN ID 0.
>
> Fixes: ed64639bc1e08 ("net: stmmac: Add support for VLAN Rx filtering")
> Signed-off-by: Ovidiu Panait <ovidiu.panait.rb@...esas.com>
Reviewed-by: Maxime Chevallier <maxime.chevallier@...tlin.com>
Maxime
Powered by blists - more mailing lists