Article View: linux.kernel.netdev
Article #21400[PATCH wireless 1/2] wifi: mac80211: do not copy the mesh RSN IE twice into the beacon
From: Piyus Kedia
Date: Tue, 24 Nov 2026 00:35
Date: Tue, 24 Nov 2026 00:35
92 lines
14107 bytes
14107 bytes
ieee80211_mesh_build_beacon() budgets the user's extra IE blob once:
tail_len = ... +
ifmsh->ie_len;
bcn = kzalloc(sizeof(*bcn) + head_len + tail_len, GFP_KERNEL);
but two of the builders that fill the tail draw from that blob.
mesh_add_vendor_ies() emits everything from the first vendor IE to the
end of it:
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);
while mesh_add_rsn_ie() searches the whole blob:
data = cfg80211_find_ie(WLAN_EID_RSN, ifmsh->ie, ifmsh->ie_len);
A blob that begins with a vendor IE therefore has its RSN IE emitted
twice - once inside the verbatim vendor range, once on its own - and the
tail copy runs past the allocation:
BUG: KASAN: slab-out-of-bounds in ieee80211_mesh_build_beacon+0xe3f
Write of size 479 at addr ffff88805ca1887b by task syz-executor
__asan_memcpy
ieee80211_mesh_build_beacon net/mac80211/mesh.c:1110
ieee80211_start_mesh net/mac80211/mesh.c:1187
ieee80211_join_mesh net/mac80211/cfg.c:3330
rdev_join_mesh
__cfg80211_join_mesh net/wireless/mesh.c:214
nl80211_join_mesh net/wireless/nl80211.c:15399
One NL80211_CMD_JOIN_MESH carrying such an NL80211_ATTR_IE is enough.
Confine the RSN search to the non-vendor part of the blob, so the two
builders cover disjoint ranges and their total cannot exceed the single
ifmsh->ie_len the beacon was sized with. The blob reaches us having passed
validate_ie_attr(), which walks the element chain and requires it to end
exactly at the end of the attribute, so the split returns an element
boundary that is not past ifmsh->ie_len.
An RSN IE placed behind a vendor IE is still emitted, as part of that
verbatim vendor range; nothing that a well-formed configuration sends is
dropped.
How this was found: by AI-driven fuzzing built on top of syzkaller. Its
analysis was checked by hand against the code, the fault was reproduced on
net.git main under KASAN, and the patched kernel is clean on the same
reproducer with ordinary secure-mesh beacons unaffected.
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>
---
net/mac80211/mesh.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 8f8814125375..eb54bd98f282 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -379,12 +379,19 @@ int mesh_add_rsn_ie(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb)
struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
u8 len = 0;
const u8 *data;
+ size_t prefix;
if (!ifmsh->ie || !ifmsh->ie_len)
return 0;
- /* find RSN IE */
- data = cfg80211_find_ie(WLAN_EID_RSN, ifmsh->ie, ifmsh->ie_len);
+ /* Find the RSN IE in the non-vendor part of the blob only. Everything
+ * from the first vendor IE onwards is emitted verbatim by
+ * mesh_add_vendor_ies(), and ieee80211_mesh_build_beacon() budgets
+ * ifmsh->ie_len once for both of them, so an RSN IE sitting behind a
+ * vendor IE would be copied twice and overrun the beacon's tail.
+ */
+ prefix = ieee80211_ie_split_vendor(ifmsh->ie, ifmsh->ie_len, 0);
+ data = cfg80211_find_ie(WLAN_EID_RSN, ifmsh->ie, prefix);
if (!data)
return 0;
--
2.34.1
Technical Details
Message-ID:
<20261124003526.78471-2-piyus@iiitd.ac.in>Path:
mbox-mo1.pugleaf.net!news-can.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-369873-linux-kernel-netdev=dewy.ruReferences:
<20261124003526.78471-1-piyus@iiitd.ac.in>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.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-369873-linux-kernel-netdev=dewy.ru
From: piyus@iiitd.ac.in (Piyus Kedia)
Newsgroups: linux.kernel.netdev
Subject: [PATCH wireless 1/2] wifi: mac80211: do not copy the mesh RSN IE twice into the beacon
Date: Tue, 24 Nov 2026 06:05:25 +0530
Organization: Usenet Network
Message-ID: <20261124003526.78471-2-piyus@iiitd.ac.in>
References: <20261124003526.78471-1-piyus@iiitd.ac.in>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="4016635"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:NF7vZj305uv1eG7P9mSASQkEwvs= sha256:QncHf2B3xrkeH+pjmcn67JCULHA1gCUd73jgoyGu2Rw=
sha1:dVGrUUIq5oJziQE32nB6Hk6AjbQ= sha256:z6M6wnVoM0W4ejuZ5mNyzyzVCB0FKlTYr5ksF7Na0Fo=
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 79D94125DC6; Tue, 24 Nov 2026 03:36:17 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.751
X-Spam-Status: No, score=-2.751 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_INVALID=0.1, DKIM_SIGNED=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=neutral
reason="invalid (public key: DNS error: query timed out)"
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 GH4Cs8LfdyhC;
Tue, 24 Nov 2026 03:36:06 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-369873-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id 907BD125DC8; Tue, 24 Nov 2026 03:35:50 +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 AA6ED29339; Tue, 24 Nov 2026 00:35:40 +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=1795480540;
b=daQVkSeOb9eew89aUwy0rKdpxeMuS7/ve1coww3oNCVAVKooprPDCm0LAwZvH5QfdA/R
Xq8MnIjUdWFAZxUnMG42IQeOSOjrfYqMhL85Ya4/a25TWzsciqQHnERBhPCLXMxphnQ5H
2xBmcIhAfu/u8I0VCRCT6dk1JePBQcpkLdbPTLb5A1SKy/eLuUg/xvj7Olak6gT56DmQI
kknNWaSGs4JXST4samf3OPRNwZFiqxae3UJJyPERf8sBnLIsPUlgoCdrY+GfJNNCYGjxe
Xw5C/tpzKeobB4FZXTqSae0yF13AhSc4QtaG1ptQI68Pvt5kyFaE4Topxidl5theTWQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795480540;
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:In-Reply-To:
References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
List-Unsubscribe:List-Owner:Precedence:MIME-Version:
Content-Transfer-Encoding;
bh=cEtlzbFffNbXEfnRfrfQt3jwhoK6waIbjHPV7EqbNas=;
b=LG0A77jcreTsd20tj1MfRhgKWp8p/cGtKt3KvS/L/2vjZauZR5/57jLyxTqkwPw5hbUv
kuOaq8SiQ4h6qWN/baD4uns0HfZPTXEf5Rs52IZ6PYl4LfcxXYI+esEBi5+LyQ12xMIKH
bRdAJip9W8CTO3wQju9H2fcVo9XRTG+Mx6u9fe6upTYDqLiWzAc0qTiAZVVoCy0obighm
f3SwoiiBexTlu0ENAju6W8BJuDVKbuHOVABWp57gk93UvdjQSpZ8Q2uqMiaUaPvIcWTKg
J6vpkUlfOBfhO6F3r4UeL38Z6blBm1uXPoZ0O8vDGZtdfvOlkKBbeN1ZLrRPTeo07Tw==
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=ANJWtQn0;
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 37B56606A32C;
Tue, 24 Nov 2026 00:35:40 +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=ANJWtQn0
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.215.171
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1795480539;
b=i1nQl3F4+w/07OD7PFp35WLsTkkxCYU28KyCeSeeTSw+HqkY4ssZxG9yVFEUOFDUsD/D
1b9sdJ/qq9QYA4wUlFiik34nFipDK65Lm84Ip7k+dImsc6UJVg1DS7nGe0dHz+HhoZqP3
CZASZ2Zw3fmZgZaLkEFXvmElBPrK/si6Reycp2ybntNmWc2xM7Yn/EtoSOxE6jYA2uQkm
6IaG11xzuIxOsRsUJoVhwVkw8fWTtlvVBssEmTvY5ATOuyPfdRMF/6krkjtYsB7TFqYLz
8t8DCgl7b2M2Q4bM/wmqtQz4cfDkIE4cL3AD4uSv+XPwKwgwsG7XJ1tzc133LlaW/AA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795480539;
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:In-Reply-To:References:MIME-Version:
Content-Transfer-Encoding;
bh=cEtlzbFffNbXEfnRfrfQt3jwhoK6waIbjHPV7EqbNas=;
b=c3nJeJOz+YjMWI293Cw242bZ84F+Fhk5De9iMEEYF5iozqjC7iwlDC0//SWV41d3UPEJ
p6leZPiNaiFhbw+od5KsZVtR7InIEUCTc6eZ75Ljr7mqveKXTjcFlMKaT02aO+C0hw8ov
t2X7MPFd02EX47LqBhAtdTcIrB/DVmeJfHeQUbKTIV26fMxQ0HL6jHosO1NKRX8XWNnQf
gwONlodq+nagCyIGYlJcpNaFN6JoXwJh0dI22ql9jQfrXK17feS3vJF6uF9xyhbv1FcrP
wC2Az14NoctKJAa6BWrGtRyWn1ILfXNp8N9dG18ekeLXRs698N5cM3iDi2lu3fLEuDA==
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=ANJWtQn0;
arc=none smtp.remote-ip=209.85.215.171
X-Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171])
(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 05E18606A335
for <netdev@vger.kernel.org>; Tue, 24 Nov 2026 00:35:38 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 05E18606A335
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-f171.google.com with SMTP id 41be03b00d2f7-cdb1199bfd8so1767668a12.1
for <netdev@vger.kernel.org>; Mon, 23 Nov 2026 16:35:38 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=iiitd.ac.in; s=google; t=1795480538; x=1796085338; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=cEtlzbFffNbXEfnRfrfQt3jwhoK6waIbjHPV7EqbNas=;
b=ANJWtQn07idnhIuzVfW3nPlfg6xJ5aMg8KP5bLevx3ryF2EWMf5Y2C2WnH6ulnyDwL
eyV0Rx92s0RCZMZDUL2ElO3Uo4+YC/BngcH6FawYWA+xrCOfKO9bKLQ9mOYbWuLJdHpf
HRKvwqw581M4r2LNr72lq0FbnDg2OG/qqKnD0=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1795480538; x=1796085338;
h=content-transfer-encoding:mime-version:references:in-reply-to
: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=cEt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Fnel8+CPpOPBTCXqSs2Xrx9Zn4032F3oYfQR8vQ6yZGbWuK9EU3hAzggQUdbdD//C
ASwAWQH32gRWlxbEf3MSfqVJTPxbxtQtW0yd2vHwOVH+xM9j8+9wLieUJoskgFxV7zfZZc/UP1y
SZ7pBAsFrhfs5PaOhi0px/QC8QHi4FjBLQfs5c+BY9l7EkZABYNZ4VFEcfa0nSfFt
X-Received: by 2002:a05:6a21:9188:b0:3eb:abb7:f92c with SMTP id adf61e73a8af0-4014cb3eed2mr11300988637.22.1795480538338;
Mon, 23 Nov 2026 16:35:38 -0800 (PST)
X-Received: from iiitd-S2600STB.iiitd.edu.in ([103.25.231.160])
by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-cde6cfc8829sm6076667a12.8.2026.11.23.16.35.34
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Mon, 23 Nov 2026 16:35:37 -0800 (PST)
X-Cc: netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
Kapil Vaswani <kapil@presceralabs.ai>,
Piyus Kedia <piyus@iiitd.ac.in>,
stable@vger.kernel.org
X-Mailer: git-send-email 2.34.1
X-In-Reply-To: <20261124003526.78471-1-piyus@iiitd.ac.in>
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