Re: [PATCH v3 1/3] net: atlantic: AQC113: Ensure L2 filter count is valid
From: netdev-bot+sashiko
Date: Sat Nov 28 2026 - 10:39:23 EST
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] In hw_atl2_utils_get_filter_caps()
(drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c,…
--
net: atlantic: AQC113: Ensure L2 filter count is valid
This commit checks the firmware-provided l2_filter_count in
hw_atl2_utils_get_filter_caps(). If the value is outside [1, HW_ATL2_MAC_MAX],
the count is recomputed from the already validated l2_filters_base_index.
> diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c
> index dc9b2ef4640b1..9ad5bbb11bdf8 100644
> --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c
> +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils_fw.c
> @@ -629,6 +629,8 @@ int hw_atl2_utils_get_filter_caps(struct aq_hw_s *self)
> if (priv->l2_filters_base_index >= HW_ATL2_MAC_MAX)
> priv->l2_filters_base_index = HW_ATL2_MAC_UC;
> priv->l2_filter_count = filter_caps.l2_filter_count;
> + if (priv->l2_filter_count < 1 || priv->l2_filter_count > HW_ATL2_MAC_MAX)
> + priv->l2_filter_count = HW_ATL2_MAC_MAX - priv->l2_filters_base_index;
[Severity: Medium]
Should the upper bound here be HW_ATL2_MAC_MAX - l2_filters_base_index
instead of HW_ATL2_MAC_MAX?
The fallback treats the count as the number of slots from the base to the
end of the 38-entry table. The accept condition does not apply that bound,
so a count that does not fit after the base still gets through.
For example, base = 30 passes the base check (it is below 38), and
count = 38 passes the new check.
Later patches in this series use l2_filter_count as the bound for
multicast programming:
hw_atl2_get_multicast_address_max():
return min_t(unsigned int, priv->l2_filter_count - 1,
AQ_HW_MULTICAST_ADDRESS_MAX);
hw_atl2_hw_multicast_list_set():
if (count > (priv->l2_filter_count - 1)) {
With base = 30 and count = 38, this advertises 32 multicast slots. The
loop then writes slots base_location + i, which is 31..62.
The register addresses are linear in the slot index:
#define HW_ATL_RPFL2UC_DAFLSW_ADR(filter) (0x00005110 + (filter) * 0x8)
Slots 38..62 would land on MMIO 0x5240..0x5304, which is past the L2
unicast filter block. Can this misprogram unrelated RPF registers?
In the final series, hw_atl2_hw_packet_filter_set() clamps with
min(HW_ATL2_MAC_MAX - base_location, l2_filter_count - 1). The multicast
paths above use the raw l2_filter_count without that clamp.
Something like this would give every consumer the same window:
if (count < 1 || count > HW_ATL2_MAC_MAX - base)
The Apple firmware reports base = 9 and count = 29, which is consistent. So
this only applies to firmware that reports a mismatched base/count pair.
> priv->etype_filter_base_index = filter_caps.ethertype_filter_base_index;
> priv->etype_filter_count = filter_caps.ethertype_filter_count;
> priv->etype_filter_tag_top =
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261127-net-atlantic-aq113-apple-l2-filter-slots-v3-0-b5efbc124dcc%40jannau.net