Article View: linux.kernel.netdev
Article #24710Re: [PATCH wireless v3] wifi: mac80211: mesh: avoid duplicating RSN IE after vendor IEs
From: netdev-bot+sashiko
Date: Mon, 30 Nov 2026 17:21
Date: Mon, 30 Nov 2026 17:21
178 lines
14160 bytes
14160 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 ยท High: 1 ยท Medium: 0 (1) ยท Low: 1
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.
- [Low] The Signed-off-by chain does not show what role Kapil Vaswani
played.
Pre-existing issues:
- [Medium] The uAPI policy and the internal field width disagree.
--
wifi: mac80211: mesh: avoid duplicating RSN IE after vendor IEs
This patch limits the RSN element search in mesh_add_rsn_ie() to the part
of the mesh IE blob before the first vendor IE. The goal is that
mesh_add_vendor_ies() and mesh_add_rsn_ie() no longer both emit the same
RSN IE. The split offset is also clamped to ifmsh->ie_len, because a
truncated u8 ie_len can end in the middle of an element.
Link: https://lore.kernel.org/all/20261125043805.883952-1-piyus@iiitd.ac.in/
> Signed-off-by: Kapil Vaswani <kapil@presceralabs.ai>
> Signed-off-by: Piyus Kedia <piyus@iiitd.ac.in>
[Severity: Low]
This isn't a bug, but the From: author is Piyus Kedia, the first
Signed-off-by is Kapil Vaswani's, and there is no Co-developed-by: tag.
Documentation/process/submitting-patches.rst says co-authors get a
Co-developed-by: tag, followed right away by their Signed-off-by:. It also
says the SOB order should follow the patch's history.
Is a Co-developed-by: tag missing here, or should the SOB order change?
> diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
> index 8f88141253758..3e1a3273801be 100644
> --- a/net/mac80211/mesh.c
> +++ b/net/mac80211/mesh.c
> @@ -377,14 +377,27 @@ int mesh_add_vendor_ies(struct ieee80211_sub_if_data *sdata,
> int mesh_add_rsn_ie(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb)
> {
> struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
> + size_t prefix;
> u8 len = 0;
> const u8 *data;
>
> if (!ifmsh->ie || !ifmsh->ie_len)
> return 0;
>
> + /*
> + * Only search before the first vendor IE: mesh_add_vendor_ies()
> + * copies everything from that point onward verbatim, so an RSN IE
> + * after a vendor IE would otherwise be emitted twice and overrun
> + * the beacon allocation.
> + *
> + * Clamp to ifmsh->ie_len because ieee80211_ie_split_vendor() can
> + * overshoot if a truncated ifmsh->ie_len ends mid-element.
> + */
[Severity: Medium]
This is a pre-existing issue, but the truncation this comment mentions
seems to come from a mismatch between the uAPI policy and the field width.
mesh_setup_params_policy in net/wireless/nl80211.c accepts up to
IEEE80211_MAX_DATA_LEN (2304) bytes:
[NL80211_MESH_SETUP_IE] =
NLA_POLICY_VALIDATE_FN(NLA_BINARY, validate_ie_attr,
IEEE80211_MAX_DATA_LEN),
copy_mesh_setup() in net/mac80211/cfg.c kmemdup()s the whole buffer. It
then stores the size_t length in the u8 ifmsh->ie_len without a range
check:
ifmsh->ie_len = setup->ie_len;
ifmsh->ie = new_ie;
So any IE blob of 256 bytes or more is cut down modulo 256 without any
error, and the cut can land inside an element.
Would beacons and peering frames then carry a partial or malformed
element? When the length is an exact multiple of 256, would they carry no
IEs at all?
> + 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]
Is the clamp enough to keep the two helpers' ranges disjoint? The clamp
exists only here. mesh_add_vendor_ies() still stores the same split result
in a u8:
net/mac80211/mesh.c:mesh_add_vendor_ies() {
u8 offset, len;
...
/* fast-forward to vendor IEs */
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;
...
}
Suppose ieee80211_ie_split_vendor() overshoots to 256 or more. Here,
prefix becomes ifmsh->ie_len. In mesh_add_vendor_ies(), offset wraps
modulo 256 instead, so it can pass the offset < ifmsh->ie_len check.
As an example, take a well-formed 511-byte NL80211_MESH_SETUP_IE with
three elements:
- an RSN element with 252 bytes of data at offset 0
- an element with 0 bytes of data at offset 254
- an element with 253 bytes of data at offset 256
The call chain then goes like this:
copy_mesh_setup()
ifmsh->ie_len = 511 & 0xff = 255 (full 511-byte buffer kept)
ieee80211_ie_split_vendor(ie, 255, 0)
walks 0 -> 254 -> 256, returns 256
mesh_add_rsn_ie()
prefix = min(256, 255) = 255
finds the 254-byte RSN at offset 0 and emits it
mesh_add_vendor_ies()
offset = (u8)256 = 0
0 < 255, so all 255 bytes are copied again, RSN included
That is 509 bytes of IEs. ieee80211_mesh_build_beacon() reserves only one
ifmsh->ie_len in tail_len to cover both helpers.
The skb_tailroom() checks look at the scratch skb, not at the beacon_data
allocation. If unused optional IEs (HT/VHT/HE/EHT) leave slack there,
those checks pass, and the final copy writes past beacon_data:
ieee80211_mesh_build_beacon()
bcn->tail_len = skb->len;
memcpy(bcn->tail, skb->data, bcn->tail_len);
Can this still overflow beacon_data the same way as the KASAN report in
the commit message? mesh_plink_frame_tx() uses the same two helpers. Would
it also still emit a duplicate RSN IE in peering frames?
The commit message and the new comment both say the two helpers cover
disjoint ranges:
Restrict mesh_add_rsn_ie() to the prefix before the first vendor IE so
the two helpers cover disjoint ranges
That doesn't seem to hold for this input. Any of these might close the
gap:
- compute the offset in mesh_add_vendor_ies() the same way (size_t with
the same clamp, or a shared helper)
- reject setup->ie_len above 255 in copy_mesh_setup()
- widen ifmsh->ie_len
Would one of them make sense?
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261129171732.1877563-1-piyus%40iiitd.ac.in
Technical Details
Message-ID:
<179605927904.3146.1761227326662245564@kernel.org>Path:
mbox-mo1.pugleaf.net!news-fra.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374339-linux-kernel-netdev=dewy.ruReferences:
<20261129171732.1877563-1-piyus@iiitd.ac.in>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-fra.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374339-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH wireless v3] wifi: mac80211: mesh: avoid duplicating RSN IE after vendor IEs Date: Mon, 30 Nov 2026 17:21:19 +0000 Organization: Usenet Network Message-ID: <179605927904.3146.1761227326662245564@kernel.org> References: <20261129171732.1877563-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="1483112"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:CbKtRqhORxR9V9OIg6gXb04GvLU= sha256:12rt5nZy7k3MGW/a61FAi+Pxs9NHeV4znyZIU+7uU3M= sha1:WYjFVAU5KN5+JxoPWyEta8fTWls= sha256:rFcI/Lc6o3fM6DHLRQIM1YWp6ksTgudJlzc8OhSr8uo= 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 78A59125FF8; Mon, 30 Nov 2026 20:21:54 +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 LthzBHrrU9Qz; Mon, 30 Nov 2026 20:21:50 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374339-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 05177125FF7; Mon, 30 Nov 2026 20:21:41 +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 27ABF36BED; Mon, 30 Nov 2026 17:21:30 +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=1796059281; b=t3W4ssaGQaqFgkSrWHIsAp2HtKdSo3lodITgylRtacZUz/zm6NNmlJMrklq3/03qdZgf LLS3sloONigyBrh1cBB8wEkqeLqmmTMfASIG8H1IoRtOXDTC5XduhGDs14+75GUE31OiM 0e6Uieoj4FLkSdaQ8YCOaSay1zVC3iIsvmW4lI1PEo9mEVfW49kiXNw+fiNVljzSGlluG d4r91FOPak4KKoW7KIX6sgsEpo3ual21w6Ztu3vI3SktqGQojMZTfG9Epp8SqNyynhRuP NhgOMhB7GzErnM8uXrztX/vIx8jicttrJeKJVm8Ghn67VpagZqIGh0eZ7elNx77+krg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796059281; 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=8h13TQbSTMwmpso3YxaI+211i96fKJdtNRS5IMg4k+k=; b=aoYkonW8v7uXONxQUk58FGG+H5bjIJenXMbtG/x9r1TnHGEeyUlVI1xThGnAXhOP+anm X7vkeUEtAousZTU5lTWVs1GVjHqAxFbftcXce/6yqKPhe/CoyT+0d/vMhx49HwQBcIhqY YTeLHGaFjOQ7kRB2OCWtkYBkZ3cL8oqIieEHuY5AV81XD3sMX5gOM+5h7eUgFNfU1p3QH iS46flsVoWlvx+V7a/y/eci9pWX8pDKQ/XwP9bXJJvcH4DbbbKzhHeGfkVPpxCEk9PEzx LYc98uCEyTSUpkUwjV38BzJ7uOnyudBqNDF+L005wR2W57aErbOH02dnRf2UBoRQ6GA== 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=NCYelAUx; 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 4515B606A689; Mon, 30 Nov 2026 17:21:21 +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=NCYelAUx 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=1796059280; b=xO5XOWSllSECbh5qBJ8GVSETZy9cUHIIYNcgC+TNhpyS/UsxqQ7o8YBbHAHEiSJ1+Ih3 za50ALjplAaXI9LqNDH6dPGh/KxTQgSo/XuxhJUSjqgA2kVUPK8P6swMrh2bGFgkbMvy4 I/Yu+ScBKY3PTpHEsYEUWIFuqwx30FgHCKSnG9SwoH1NHDyFUv2F9ez0Nnezo0ixw9zAH vqnuA6p59DOJVxwyTFT5lb2FZbjMHhHO6xz/6tzJuCwlGvNKNb5tLNTzNiPNV/zMJraFD ysC+fDFU2p4wDamEVBCM0F23FozAHiCKayrPnqOAqy/Gnz1lBfsTPUxuX0QN5V8YK5A== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796059280; 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=8h13TQbSTMwmpso3YxaI+211i96fKJdtNRS5IMg4k+k=; b=qYg/JbzokvtzIOZnG/LI7HkTMOIloGfpWlO9mOcWJDl5dcsezpc9PWovwjWhzi/Gb2Xq v7U9k/z+iD7PsgC1+DHJ1bfg70iCJ9RINP5ZmmPeKOvkUOMQ3TdykHqVqGY7zgapHT3Mc j+pluzoolE3/h0bNvtPSPyxzw3mEHUFPN3D8pMTu8ovPgjquqez/DkIh3FJbnyyq5uin5 JCo9ciuQfrCIETr3rNFOI0McxC7VaWg+6AGtCntJa5rrw8rsryHYJ7IafhkSyweXGiqWt vKuODxB1zB8EM2iWwdIzAR2UbgG6cJ7r+26C5cUuUzDnfKOtJI6eTOUTAUzEPI4b4qQ== 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=NCYelAUx; 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 6317F606A327; Mon, 30 Nov 2026 17:21:20 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86D8F1F000C1; Mon, 30 Nov 2026 17:21:19 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796059280; bh=8h13TQbSTMwmpso3YxaI+211i96fKJdtNRS5IMg4k+k=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=NCYelAUxFWnvFJPMHieXarKorEXeoFhik3c8aruBmn4OVdXUsF6UW036P9EYsKgAT UuL0GegeQTJyD/ZMtYXouHbu3NDaPcJ/gl1+fUyoPykTbGZm/F6XTQ/C4vtT2PR3oL t8hwDBvAYRpzT7NeYDs/YdL7KYAixdnecgCuAVVQHcVhetAhr6igRbhJ3nTg8D6Tfq bFT/uOdnsorrYz+QdtM+BbG7w6oDoda4wu4Uk+H9eOpHN3q9s3vPFA7rrLHBknjPoq 8yha0pkMW4xPRr1y7KaKotZ7quNXbQYsAmZNmYIkLJcdVsVjnrxR+cCq0pYmSbsKzh tNgkHRuVAw52A== 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: <20261129171732.1877563-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