Article View: linux.kernel.netdev
Article #24204[PATCH wireless v3] wifi: mac80211: mesh: avoid duplicating RSN IE after vendor IEs
From: Piyus Kedia
Date: Sun, 29 Nov 2026 17:17
Date: Sun, 29 Nov 2026 17:17
97 lines
14202 bytes
14202 bytes
mesh_add_rsn_ie() searches the entire mesh IE blob for an RSN element,
while mesh_add_vendor_ies() copies everything from the first vendor IE
to the end verbatim. When an RSN IE follows a vendor IE, both helpers
emit it, exceeding the single ifmsh->ie_len allocation reserved by
ieee80211_mesh_build_beacon(). Because the scratch skb's rounded-up
tailroom absorbs the extra bytes, the builders' skb_tailroom() checks
succeed and the subsequent memcpy() into beacon_data overflows.
Restrict mesh_add_rsn_ie() to the prefix before the first vendor IE so
the two helpers cover disjoint ranges (an RSN IE after a vendor IE is
still emitted as part of the trailing vendor block). Clamp the split
offset to ifmsh->ie_len, as ieee80211_ie_split_vendor() can overshoot
when ifmsh->ie_len (truncated to u8 in copy_mesh_setup()) ends
mid-element.
This also stops mesh_plink_frame_tx() from emitting duplicate RSN IEs
in peering frames, as it uses the same two helpers.
Found by AI-driven fuzzing on top of syzkaller via a mesh join with a
vendor IE followed by an RSN IE in NL80211_MESH_SETUP_IE. On net.git
main it writes 479 bytes past the allocation:
BUG: KASAN: slab-out-of-bounds in ieee80211_mesh_build_beacon+0xe3f/0xec0
Write of size 479 at addr ffff88805ca1887b by task x/9448
__asan_memcpy+0x40/0x70
ieee80211_mesh_build_beacon+0xe3f/0xec0
ieee80211_start_mesh+0x192/0x220
ieee80211_join_mesh+0x6e1/0x7a0
rdev_join_mesh+0xcc/0x210
__cfg80211_join_mesh+0x9b7/0xc10
nl80211_join_mesh+0x932/0xa90
genl_family_rcv_msg_doit+0x1b0/0x260
netlink_rcv_skb+0x183/0x2b0
netlink_sendmsg+0x6d2/0x840
Fixes: 2b5e19677592 ("mac80211: cache mesh beacon")
Cc: stable@vger.kernel.org
Signed-off-by: Kapil Vaswani <kapil@presceralabs.ai>
Signed-off-by: Piyus Kedia <piyus@iiitd.ac.in>
---
Link: https://lore.kernel.org/all/20261125043805.883952-1-piyus@iiitd.ac.in/
Changes in v3: the commit message, the subject, and the code comment. The
code is byte-identical to v2 - the only lines that differ in the diff are
comment text.
v2's message restated the code at length and quoted fourteen lines of it;
this one keeps the three things the diff does not show - that the two
helpers' ranges overlap, why the bound has to be clamped, and that mesh
peering frames are affected too - and drops the rest. The comment is cut
the same way. The trimmed KASAN backtrace is new in v3; the full log is
in the [BUG] posting linked above.
Changes in v2, for the record: the search bound was clamped to ifmsh->ie_len,
without which this patch added a second route to the overrun it fixes; the
netlink attribute was corrected to NL80211_MESH_SETUP_IE; and the
peering-frame effect was documented.
---
net/mac80211/mesh.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 8f8814125375..3e1a3273801b 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.
+ */
+ 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);
if (!data)
return 0;
--
2.34.1
Technical Details
Message-ID:
<20261129171732.1877563-1-piyus@iiitd.ac.in>Path:
mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373606-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373606-linux-kernel-netdev=dewy.ru
From: piyus@iiitd.ac.in (Piyus Kedia)
Newsgroups: linux.kernel.netdev
Subject: [PATCH wireless v3] wifi: mac80211: mesh: avoid duplicating RSN IE after vendor IEs
Date: Sun, 29 Nov 2026 22:47:32 +0530
Organization: Usenet Network
Message-ID: <20261129171732.1877563-1-piyus@iiitd.ac.in>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="1221302"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:iz9xncIySGYonj48lQlydIZ5b1A= sha256:JHgVTYdR6wvSeB0HqQUZc+We5XUPmmczld7p4HcqDMQ=
sha1:bBckmhkhTBNUuzGrYgroscYUWMk= sha256:n2dXuPxmvyEmrQdOA2WlKa8bnlwh7pUMNPTRlmFKZsw=
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 8AA4A125F9A; Sun, 29 Nov 2026 20:18:03 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.151
X-Spam-Status: No, score=-3.151 tagged_above=-9999 required=6.31
tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
HEADER_FROM_DIFFERENT_DOMAINS=0.249, 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 (1024-bit key)
header.d=iiitd.ac.in
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 HxiKyWIT10yJ;
Sun, 29 Nov 2026 20:17:57 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-373606-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=iiitd.ac.in
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mail.dewy.ru (Postfix) with ESMTPS id B075F125F96; Sun, 29 Nov 2026 20:17:43 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by tor.lore.kernel.org (Postfix) with ESMTP id 4F4E923D62; Sun, 29 Nov 2026 17:17:42 +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=1795972661;
b=FiCSuD1AlsMESu34HBCysnpT1pFtw0QjrCBvMjNYV4yyKApfjdTq+TBzf8BXhX6swXQ7
xb8MVtYiSqzxgCGK2zeWN8aqmeGkUJiVLh3THnuLy5MXqK/00IcEDvcHpCxgisefL7x+z
w8kjqLsGw6l3jxJnCjWsPiwzGS41swHocRxmTvUhW7aPSlE9mit6r2Encf2cAe2vbRWbQ
uKLDgxOVh3JATXs70EpdZzmayuUM4DwgUw7O8fA1BwTr6ED/JEZI+Hmb9chUOfFEGvuCj
n5PJ8jMKP6AqQLzXLOdWiMe2UkGtoONi/N13KRL/0fQ1+j+Cty1qxiGNuY/rn1JwrXg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795972661;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:X-Mailing-List:
List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
List-Owner:Precedence:MIME-Version:Content-Transfer-Encoding;
bh=ocJakScKMeMVogqWN/84lvXA4nrz/sK6DVNF9z7rU9E=;
b=D4q0AVlhiPbqUSEzhngpWAkxUcRbP/OJd6zUTZwESWalAqn2uwSm544idYrdoxNP0CNU
lqxVB3QPVRUShDLhu7IQMthuI2g/5Vqe+ahRGdzdH8NzT7iN2YkRiFYiJuXMjq71b9BS7
cL94vLYhL1Gc11z/rvlt1Sqesp5xgRKJ4okUWW4YgnvYw0SgcoUm8zsp4ZLeyP2Qqtm/g
0SHw6zEbs6bPb5LYv38fgbN1kIBz6hVlvaMX5JlBRBvh+Du9Q+TPDBRZNRXDka3hWVD47
5KBbDdKn9gfOHQU3KC4tImS1E69Q3BZyLJb3/uTd2IFhosLXzsLXIs63WGZTtSdud1Q==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=iiitd.ac.in header.i=@iiitd.ac.in header.a=rsa-sha256 header.s=google header.b=QecDdf0r;
dmarc=none header.from=iiitd.ac.in;
spf=pass smtp.mailfrom=iiitd.ac.in;
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 357EE606A33A;
Sun, 29 Nov 2026 17:17:41 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=iiitd.ac.in header.i=@iiitd.ac.in header.a=rsa-sha256 header.s=google header.b=QecDdf0r
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.215.179
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1795972660;
b=wQDoxt8H4uHTwEQSAA24P4B3WKqNJPJXl11PZUwrM3cwMq7+ERVKcESKI0Ba9ca5NakY
zLMW2qmq0dQ0ZhMJsGLinZPaABRpK5AMW28hnwRcsRVipmHOTIVHSIK/u1/bYT6CfMRS9
+lIwq78oH0AKaaq2HqrTjvL7ZApzuYmF13ToMbclQ62DjOTau0taiX+6qMDpNM7Sc2fLN
2P29qqtjJV18L3MmLpFwLvf4rWVxODXoXqwo8ZYlPP9m3fcTZjpOQZhPld9riYhiyEnB9
APmA7DMwReAouDy/Idf+2PVC/mB8zLUflA5JqMmXV80uJZ/yI0oUzkymVm72YHbnAsQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795972660;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:
Date:Message-Id:X-Mailer:MIME-Version:Content-Transfer-Encoding;
bh=ocJakScKMeMVogqWN/84lvXA4nrz/sK6DVNF9z7rU9E=;
b=rCtF2FODVSnJYw1xe2kryn7SLigp2EzpwFCK0EejHkcXKhkB2ixLmQvwDBd4wOqs8q1L
zIbav6IP+KoWcVu0RoIHv2ERbc7U1+NGKOun/+TT2Nsm9rxhoSlrYLt+D2/JqnBJGmoEm
xH1KzzIcpfEcUo29Ev8hHXTdvSWvloUEMRJ4pR0GoAtNlnu/1yshR+4wb1Dwhm89SXK+c
NmEmNB6YvrVUZdwsr20GpoKtY4KWRES94bcUy94vipfcNuCDi8Pn7m2QayCJXbUsJflTS
F/GYrIDek5NCyqyRjXQsYLy2+fZXgkJ53tSqGA3Mmq4FMmhSQEG3vpjalAxXj6KiB/g==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=none header.from=iiitd.ac.in;
spf=pass smtp.mailfrom=iiitd.ac.in;
dkim=pass header.d=iiitd.ac.in header.i=@iiitd.ac.in header.a=rsa-sha256 header.s=google header.b=QecDdf0r;
arc=none smtp.remote-ip=209.85.215.179
X-Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id EEA1B606A323
for <netdev@vger.kernel.org>; Sun, 29 Nov 2026 17:17:38 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EEA1B606A323
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iiitd.ac.in
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iiitd.ac.in
X-Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-cddc250d815so3633279a12.2
for <netdev@vger.kernel.org>; Sun, 29 Nov 2026 09:17:38 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=iiitd.ac.in; s=google; t=1795972658; x=1796577458; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:from:to:cc:subject:date:message-id:reply-to:content-type;
bh=ocJakScKMeMVogqWN/84lvXA4nrz/sK6DVNF9z7rU9E=;
b=QecDdf0r/Dkgs8XQF/XziBJvAIl+pte7vF4cv/hyu1k6xTB30oXth7+kqO9FwpZTo4
BP/mHInKt4GvozjLXpTISaCfAQD+8/JMqs0wkEJJgVw5IhKLARE2n2J/jsdb7Zs3c2nA
u6WpkD4rdcqjpzbYIU0fUzTCOUuX5cl+aNhO8=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1795972658; x=1796577458;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=ocJakScKMeMVogqWN/84lvXA4nrz/sK6DVNF9z7rU9E=;
b=yZzpUsaW0CzZozFbV8nztzUju+zF7s1Autq0iHY//4s9pEYG49Fp/kMQjsbsg63Sh2
Mn6TSn3tIeZRCmsM1qy+8loP6ytomJDBArgsC1pUe70MMJy5OYN6Q8FRfW8lbtwJ57bo
7Lwfp+wLmeL12dUUHJjZNsWz+Bx1PTKOc4HRS7emvmrD9Bk2tgZUo5tLytqwCfQQL/SO
y7uG+cJAyNSeIkBq8s62sth8KuoY22eAWiiHtJgZIjx9hYML7hGwz9rMPWMTvrHCYwQO
k3C6znqh1nhC1qaM/H9yZDUDte6Y+oowuS3jLNKXRS6QVbd+rvDFuK9UBFNfVn2mXT5o
3gnw==
X-Gm-Message-State: APuU4Z9uHsKyCe2umWx1AK//apc8WDn8e+NJs3wa7oVu9aBlNa0mdn4e
zitxdQt012iE+1MRE2GWj8Yo2T7L646S6JjEzwqKoRP27ZmlG1GzQvWkXlD2FdG58Ns=
X-Gm-Gg: AZFdTZeN2CE7RovtNX/VTiVYPwc34i+bIQj/OmT9FojZLfuRsa5F3gSYpqQa9grNCZE
JolQXwu8zwUOffnUUVkQZ8onWJ4nHAFwB1Q8VJuuJQDPFlerwEtKpYEO/OSVBJgbJJKU21OoEQt
NkmS1I8FUOip4hRQjZd7TvTl9cEE6hUvJQ9HfJd2uL7RFMWcGZ6F2+02QrRNuPO0oRLYGGh5a3s
Jnue5Sblh9LVwoOMnX3rU4rPunkGK5uFhdSzYSgpR1Vr4wJn08gRPcRSJ3/Oz4ytsWP1eW3phKJ
BAJqM7fS6s81Q1tC1QCsVA8+xikHZd92NAd1tH97i7Ee826g7nMGmX6zqOgPP8MJQViU4kCgyBF
uK4IlR1+IKYwj7Y2hdBuGSHVgWeTJIBoGUGaUBmR0lZL6/VnGJMjCIksNDUsGGQy7+zMKDIp2SG
7UJeooA/cB8Eq8x5I3oZD/sUTKXoY+GHa6dBk7SO3owtIV6aKEOOhZpbOhUCXUsvvXrd819uu81
2ue85DnkNVoIPipzqPHjnUVimn4khhgxBz9/0gD2xtUlAs/TUU7SGTB2jtrw8Dq1Obhy17oVAKd
4ThgGc2gl1kjItj+6GOmeMDSJHKpPjY+++fEtEfu6fk6m1RdRG3ikyzxAuZNpG81C3EScXjd51Z
lmMzQF6muAvrOBl7bObqKXv+B1kwmKCQm0FiHa8GFUGcQerbPTEqqC7AdYTiZcVPb
X-Received: by 2002:a17:90b:1652:b0:3b5:32db:116 with SMTP id 98e67ed59e1d1-3b532db0403mr9639768a91.27.1795972658224;
Sun, 29 Nov 2026 09:17:38 -0800 (PST)
X-Received: from iiitd-S2600STB.iiitd.edu.in ([103.25.231.160])
by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b40578d771sm50043695a91.1.2026.11.29.09.17.34
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Sun, 29 Nov 2026 09:17:37 -0800 (PST)
X-Cc: netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
Kapil Vaswani <kapil@presceralabs.ai>,
stable@vger.kernel.org
X-Mailer: git-send-email 2.34.1
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