Re: [PATCH net] net: garp: fix unsigned integer underflow in garp_pdu_parse_attr
From: Simon Horman
Date: Tue Jun 02 2026 - 12:18:41 EST
On Wed, May 27, 2026 at 04:31:58PM +0800, Yizhou Zhao wrote:
> The receive-side GARP attribute parser computes dlen with reversed
> operands:
>
> dlen = sizeof(*ga) - ga->len;
>
> ga->len is the on-wire attribute length and includes the GARP attribute
> header. For normal attributes with data, ga->len is larger than
> sizeof(*ga), so the subtraction underflows in unsigned arithmetic.
>
> The resulting value is later passed to garp_attr_lookup(), whose length
> argument is u8. After truncation, the parsed data length usually no
> longer matches the length stored for locally registered attributes, so
> received Join/Leave events are ignored. This breaks the GARP receive path
> for common attributes, such as GVRP VLAN registration attributes.
>
> Compute the data length as the attribute length minus the header length.
>
> Fixes: eca9ebac651f ("net: Add GARP applicant-only participant")
> Reported-by: Yizhou Zhao <zhaoyz24@xxxxxxxxxxxxxxxxxxxxx>
> Reported-by: Yuxiang Yang <yangyx22@xxxxxxxxxxxxxxxxxxxxx>
> Reported-by: Ao Wang <wangao@xxxxxxxxxx>
> Reported-by: Xuewei Feng <fengxw06@xxxxxxx>
> Reported-by: Qi Li <qli01@xxxxxxxxxxxxxxx>
> Reported-by: Ke Xu <xuke@xxxxxxxxxxxxxxx>
> Assisted-by: GLM:GLM-5.1
> Signed-off-by: Yizhou Zhao <zhaoyz24@xxxxxxxxxxxxxxxxxxxxx>
Reviewed-by: Simon Horman <horms@xxxxxxxxxx>
FTR, there is an AI generated review of this patch available on sashiko.dev.
I suggest that the issues raised there can be looked at in the context
of possible follow-up rather than something that blocks progress of this
patch.