๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24057

Re: [PATCH wireless v2] wifi: mac80211: do not copy the mesh RSN IE twice into the beacon

#24057
From: netdev-bot+sashiko
Date: Sun, 29 Nov 2026 04:54
118 lines
11916 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 ยท High: 1 ยท Medium: 0 ยท 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).

- [High] The fix is incomplete.

--

wifi: mac80211: do not copy the mesh RSN IE twice into the beacon

This patch makes mesh_add_rsn_ie() search only the part of the mesh IE
blob that comes before the first vendor element. An RSN element placed
behind a vendor element is then no longer emitted by both
mesh_add_rsn_ie() and mesh_add_vendor_ies(). The search bound is clamped
to ifmsh->ie_len, because ifmsh->ie_len is a u8 that can be truncated
from the netlink attribute length.

Link: https://lore.kernel.org/all/20261124003526.78471-2-piyus@iiitd.ac.in/

> diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
> index 8f88141253758..c86be97bc9219 100644
> --- a/net/mac80211/mesh.c
> +++ b/net/mac80211/mesh.c
> @@ -377,14 +377,32 @@ int mesh_add_vendor_ies(struct ieee80211_sub_if_data *sdata,

[ ... ]

> +	prefix = ieee80211_ie_split_vendor(ifmsh->ie, ifmsh->ie_len, 0);
> +	prefix = min_t(size_t, prefix, ifmsh->ie_len);
> +
>  	/* find RSN IE */
> -	data = cfg80211_find_ie(WLAN_EID_RSN, ifmsh->ie, ifmsh->ie_len);
> +	data = cfg80211_find_ie(WLAN_EID_RSN, ifmsh->ie, prefix);

[Severity: High]
Do the two helpers still use the same boundary when the split position
is 256 or more?

mesh_add_vendor_ies() stores the same ieee80211_ie_split_vendor() result
in a u8:

net/mac80211/mesh.c:mesh_add_vendor_ies() {
	u8 offset, len;
	...
	offset = ieee80211_ie_split_vendor(ifmsh->ie, ifmsh->ie_len, 0);

	if (offset < ifmsh->ie_len) {
		len = ifmsh->ie_len - offset;
		data = ifmsh->ie + offset;
		...
		skb_put_data(skb, data, len);
	}
}

As the new comment says, the split can return a value past
ifmsh->ie_len when ifmsh->ie_len was truncated. Suppose that value is
256:

  mesh_add_rsn_ie() clamps prefix to ifmsh->ie_len.

  mesh_add_vendor_ies() wraps offset to 0 and copies the whole
  [0, ie_len) range verbatim.

Here is an example. A JOIN_MESH with a 511-byte NL80211_MESH_SETUP_IE
leaves ifmsh->ie_len at 255 after copy_mesh_setup(). The blob is laid
out like this:

  offset 0:   RSN, len 252 (254 bytes)
  offset 254: non-vendor element, len 0 (2 bytes)
  offset 256: non-vendor element, len 253 (255 bytes)

The split walk goes 0 -> 254 -> 256 and returns 256. Then:

  mesh_add_rsn_ie() gets prefix = 255, finds the RSN element and emits
  254 bytes.

  mesh_add_vendor_ies() gets offset = (u8)256 = 0 and emits another 255
  bytes, which contain the same RSN element.

ieee80211_mesh_build_beacon() reserves ifmsh->ie_len bytes only once in
tail_len, and then does:

	bcn->tail_len = skb->len;
	memcpy(bcn->tail, skb->data, bcn->tail_len);

Wouldn't this be the same slab-out-of-bounds write in
ieee80211_mesh_build_beacon(), even with no vendor element in the blob?

This route also existed before the patch. However, the commit message
says:

    Search only the part of the blob that comes before the first vendor
    element, so the two emitters cover disjoint ranges and their combined
    output fits the budget.

The note below the fold also says:

    This patch is safe without it: the clamp makes the bound no wider than
    ifmsh->ie_len whatever ifmsh->ie_len happens to be.

The patch is tagged for stable as a standalone fix. A backport of only
this patch would therefore still leave the overrun in place.

Could the u8 truncation itself be removed instead? One option is to
reject setup->ie_len > 255 in copy_mesh_setup(). Another is to widen
ifmsh->ie_len and the offset and len locals in mesh_add_vendor_ies() to
size_t. Either one would also make the new clamp unnecessary.

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261125043805.883952-1-piyus%40iiitd.ac.in
Technical Details
Message-ID: <179592805216.3146.5975241126695201853@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373378-linux-kernel-netdev=dewy.ru
References: <20261125043805.883952-1-piyus@iiitd.ac.in>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373378-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH wireless v2] wifi: mac80211: do not copy the mesh RSN IE twice into the beacon
Date: Sun, 29 Nov 2026 04:54:12 +0000
Organization: Usenet Network
Message-ID: <179592805216.3146.5975241126695201853@kernel.org>
References: <20261125043805.883952-1-piyus@iiitd.ac.in>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network; logging-data="1104132"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:badjIyzELFfk/P0n59SE4BPq7rA= sha256:3XzR5OSA6Y6XZ1AAehj9GwB2CIOBhOdL6UhrSlUAXAE= sha1:8bheBcckr1ZiTocj2PnCpPtY+nA= sha256:psWUfQg/cumxJUbKqV4fORiSgA1ONZ/KbgKTnhHGbT0=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id A5348125F93; Sun, 29 Nov 2026 07:54:35 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2B4SgJ_DPm_q; Sun, 29 Nov 2026 07:54:32 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-373378-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id B3E97125F90; Sun, 29 Nov 2026 07:54:22 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id C96A326305; Sun, 29 Nov 2026 04:54:15 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795928054; b=oDeFbHR2iMTTIFbro9DDJHvjOGiKDxC590Pk2mPRPrpUPzATKwm7dgQznf1uzF6+YDB4 MrDfjNc+/5+XJy8eR4Ug4Po9idLet0aqQjAiDK/EkOF+NmIBi55gqehz09bfHFsRY0/gE nnZ3yehG7rm6NyWnqES87+hA5XhWjbizGhZu/kty29zMfM+pCRaZLvPlhuPE5qBjdkP2q 1S1aaMP7wZWaT4iUFDGDpeqy1RV6NbG6V/cY0Dd2o8+v53DCeAiSSTn/H52/BnuN7eZTA MQJB0EUT/JGKAOj5rKbclvxL6s96tyS/FFLVfqzZwB07/wReB6p5AsB/N6boDFHGZOA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795928054; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=BtleunbLOZkJceP7xR12iGexmaMyyDwRyihDJ7ZE9h0=; b=za1GfXb+xavsmpC0hcwWh9CX7y+enJGjsBWhZkK/yvTcoZvuwtzl3jGmWxg1e4fuxbGI Ip05klPtefmjoEkiHVFQHhc3cR3PtSvQlTPIg/0f7lCfuB2r953SCbcs7uVKP0JrRMgIA lwAbcjOOtAq/XwzMV2iYyAEs2NZ0AzPEn4no5trmbAtKaIGmFS5B0c+MKE8DI/2mQmr0n hkq2SqVupr72KBQhx2GF6t3YhrBdWB39y66ZgjHc7OHOpj/Z3mddVpN7Vnzx1agRj6HZ2 fEvEHrGu6kZuofK+JWp0aarnT9Oj/bLvzIywKs7IGWVFRizvxr5EZRiewCgRsso3fMQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Jzn6OOZO; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6EACD606A339; Sun, 29 Nov 2026 04:54:14 +0000 (UTC)
X-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=Jzn6OOZO
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795928053; b=PrEv3n2VfEwzIZu0A6IGUrMU1IUXTxdn1dGlktX6E0HoOElP0HugosWVfXRPT6RApbkp Bgl+0gm032z0aa3ENWAP/9ZarstvAiLvzLfkAM07sxPlpFBY+/FZa1sImP2Eek+N0qMfY bOfeFNBycHNBQGWE2Co0Janv9P+n0YzGSSrOShubKvKv6/pYCOcGpJe1UR9k/aV6BaJvE Vg1RWbIyaWMw22ZMYL+KaiqDVhPjbz1w1CT9VGcRt/o1AVnQ7z1w/EZuGW28cp9bXGIeV e+WLTkjyT/aWJe2ZRPUV4SOAF5UgWpfYQ+jj2hIwSX6JFK6VUxC+VVJ0YgbcP3d1Jew==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795928053; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=BtleunbLOZkJceP7xR12iGexmaMyyDwRyihDJ7ZE9h0=; b=vSdzUwBXMZJsnurMxizMtBPlBsOsQsyD3lkkiyq1AjciICeZzUpiRnr+S+/pQvbbPpLL M9QgfJAO8zi0pAdxugJMMHN2ye0UK+G+Pwp/a43Cw+sJxib6hsGfdwo6UNV5f42bHYier Jdcakk6q8h/0XiIvpfNsLDHRM9+TKeNkKhZhR6nLNyWazCq3/ExcwGP1KG2Ln6Qr/Kyvc +l5XhV7wTam9JnS0jqE3cvXmXo4MDq4r1trMEs9lq2D87bsB231ee7MiNo7+LqbLvQcDc Gb+pCSeuU7xWthJyaqnmc339SuZPO06Wvt7o1tEbiXFzPtVsqUgFQs3BAlCJoUD25Zw==
X-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=Jzn6OOZO; arc=none smtp.remote-ip=100.103.45.18
X-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 8E089606A31C; Sun, 29 Nov 2026 04:54:13 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3D091F000C1; Sun, 29 Nov 2026 04:54:12 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795928053; bh=BtleunbLOZkJceP7xR12iGexmaMyyDwRyihDJ7ZE9h0=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=Jzn6OOZO7WKY/GwN9DU733YkHiGL/T2gKXQhzGYQvTI+S8uTyTxKHWDbMs0rV4wCM cErclgG82sAsqO3s3INQZrnEpQ5QwhEJDqI+JemS5BKd+LXOPRBTsYJNvRXaWghBrt KCVbpt3LIpF0h7MVz1PvRwW+Pyz3WUvrqmsA0Av/vvhMvmiSfA3hURfva15f9dvrYp 2B1rZvzvjpiiEVEZO1BZwk7/LDPoi/vWKU25yzzFFcVUbTqOJ00aojCgEV9qxb3DcD MLuGUoh6Xn7m3w8d9Iv12WPnhD38Mn6cBJm8w0Gro8Hewb2ARa2ZfVzJxMJOH/M7dw ZW79dQudEacFw==
X-Cc: johannes@sipsolutions.net, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kapil@presceralabs.ai, stable@vger.kernel.org, kuba@kernel.org
X-In-Reply-To: <20261125043805.883952-1-piyus@iiitd.ac.in>
X-sashiko-severity: High
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-Received-Bytes: 11657