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=1795928053; b=PrEv3n2VfEwzIZu0A6IGUrMU1IUXTxdn1dGlktX6E0HoOElP0HugosWVfXRPT6RApbkp Bgl+0gm032z0aa3ENWAP/9ZarstvAiLvzLfkAM07sxPlpFBY+/FZa1sImP2Eek+N0qMfY bOfeFNBycHNBQGWE2Co0Janv9P+n0YzGSSrOShubKvKv6/pYCOcGpJe1UR9k/aV6BaJvE Vg1RWbIyaWMw22ZMYL+KaiqDVhPjbz1w1CT9VGcRt/o1AVnQ7z1w/EZuGW28cp9bXGIeV e+WLTkjyT/aWJe2ZRPUV4SOAF5UgWpfYQ+jj2hIwSX6JFK6VUxC+VVJ0YgbcP3d1Jew== 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== 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 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) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3D091F000C1; Sun, 29 Nov 2026 04:54:12 +0000 (UTC) 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== Subject: Re: [PATCH wireless v2] wifi: mac80211: do not copy the mesh RSN IE twice into the beacon From: netdev-bot+sashiko@kernel.org To: piyus@iiitd.ac.in 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 Date: Sun, 29 Nov 2026 04:54:12 +0000 Message-ID: <179592805216.3146.5975241126695201853@kernel.org> In-Reply-To: <20261125043805.883952-1-piyus@iiitd.ac.in> References: <20261125043805.883952-1-piyus@iiitd.ac.in> X-sashiko-severity: High Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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