From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795985133; b=gTBgKw77PT6UqzT5DSeIuLRyAHmDz7Z7OTEU1NGqcA/sgitJBkRoQfz43QwlrJVbwnKY A2lZEHhdz4TrZToABXeZNTZ+rUjULNFB+M1OARZG7WYX+JAhBZJFadCReiiTpsrV2PWa2 8HJFqYRJwdopaywlHn/QGmY3vn2VxufjmkjxIkDRHcQh5jEunETo8DkJmfwSXD9tl3TkF 08in3fVV7VWwKnUPPbuAdxk98x8Xm7NKdqwD+DzeXQCXYIx+wEPXP/pFCnILAgDnxJNTl tgagkOG9i9XlFGCkR1lhtJ4cSX3/+gCelyTjVNtN8JCXjhjJb0EsCKVI2E3z1/h7yUg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795985133; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=xjgc1s+/wMBIA94g8cH2mlRsBMScQeMKCyIile8ZhJc=; b=eUF/cK2lxyUcZi4Tdx3W5DdZfjAixDTh1i2Mxzk+nbq6ZxlFOs5axtVZqVB0EbpIEuHc SkIh+IgKsyyKVOgyW5q3DXmiaIPgcb3o08DKr2SDO/rK5FX4sEcguDP05VDKY+oiKvgiZ 9PEMPl5Ujr67IHDdREqBqhcbQtkn3+zwKOMsBLCPXOw5NK+U7q0ORpWP7TPcVEIBH2ZUe BuVgL9UTMVI9G5fvszLNkjrr2k5LT6jJzZQyDaO74XuKcTWhdyXhqb+Qs5qN/XzmWMe6g 9aIV3zRwnJAFCBoTzzbLLe5cM/Fogo1v8JrdeQEkuJCK4M/12pJR1VG8kS1K6ydMUSA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="P7f/NhPo"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E1F7606A325; Sun, 29 Nov 2026 20:45:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=P7f/NhPo Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BA551F00896; Sun, 29 Nov 2026 20:45:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795985133; bh=xjgc1s+/wMBIA94g8cH2mlRsBMScQeMKCyIile8ZhJc=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=P7f/NhPobNdoyQXe7LWUs6B9r50cpLFGeiIatTj0YDpaaV9RntQmkXEF2l4oKtIp/ JOzfaFOG4WcvvlwvE2VQrAj6kHl/I8+HwRy/AJ7xaWF+cmEXk7rD8CVyEIlzUFzGES GiuxH7oNnb5PDLYjCJiH8i0E8g0xZfKfpIrmSiGEn7voTOf/ccEnXlkvvkj3USRfgn XWsuY1cS8+Mg+5gZp9BcfVcXdnoT4PXsReG7eddahi9dZUFjv+nF9/DiVQQPeYXO6R EjbPA7j+eOp1/SeEfqDGiTcjGDNFmfGeVQ7FnYe0chaLTL737wGmup4jGncKIdEfDy TrQ4PLknQ153Q== Date: Sun, 29 Nov 2026 21:45:31 +0100 From: Lorenzo Bianconi To: Felix Fietkau Cc: linux-wireless@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH mt76-next 16/20] wifi: mt76: mt7925: bound the header gap by the linear data of a frame Message-ID: References: <20261129193131.3367661-1-nbd@nbd.name> <20261129193131.3367661-16-nbd@nbd.name> X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="kE7cdVJeUjeHqSOb" Content-Disposition: inline In-Reply-To: <20261129193131.3367661-16-nbd@nbd.name> --kE7cdVJeUjeHqSOb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Nov 29, Felix Fietkau wrote: > mt7925_mac_fill_rx() and mt7925_reverse_frag0_hdr_trans() check hdr_gap > against skb->len. A frame of several DMA buffers is not linear, and the > hardware sets the length of the first buffer. A hdr_gap past the linear > data thus still hits the BUG() in __skb_pull(), and the Ethernet header > of a first fragment is read past the linear data. >=20 > Check hdr_gap against the linear data of the skb. >=20 > Fixes: 211a71c64347 ("wifi: mt76: mt7925: drop RX frame with a header gap= past its end") > Cc: stable@vger.kernel.org > Signed-off-by: Felix Fietkau Reviewed-by: Lorenzo Bianconi > --- > drivers/net/wireless/mediatek/mt76/mt7925/mac.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c b/drivers/ne= t/wireless/mediatek/mt76/mt7925/mac.c > index d83a9fcb1bb0..09156e73df1a 100644 > --- a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c > +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c > @@ -215,7 +215,7 @@ static int mt7925_reverse_frag0_hdr_trans(struct sk_b= uff *skb, u16 hdr_gap) > struct ieee80211_hdr hdr; > u16 frame_control; > =20 > - if (skb->len < hdr_gap + sizeof(*eth_hdr)) > + if (skb_headlen(skb) < hdr_gap + sizeof(*eth_hdr)) > return -EINVAL; > =20 > if (le32_get_bits(rxd[3], MT_RXD3_NORMAL_ADDR_TYPE) !=3D > @@ -604,7 +604,7 @@ mt7925_mac_fill_rx(struct mt792x_dev *dev, struct sk_= buff *skb) > } > =20 > hdr_gap =3D (u8 *)rxd - skb->data + 2 * remove_pad; > - if (hdr_gap >=3D skb->len) > + if (hdr_gap >=3D skb_headlen(skb)) > return -EINVAL; > =20 > if (hdr_trans && ieee80211_has_morefrags(fc)) { > --=20 > 2.47.3 >=20 >=20 --kE7cdVJeUjeHqSOb Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCawyO6gAKCRA6cBh0uS2t rAbgAP9tE7MhQQcox43C7fo2lkC4xFjoEbpDsnXuy2KbItN84AD+N5AQHeaSQWad onThY4yPq0HuOR5GXrrqMZgiANW+gAk= =eRx7 -----END PGP SIGNATURE----- --kE7cdVJeUjeHqSOb--