From: Johannes Berg <johannes@sipsolutions.net>
To: Piyus Kedia <piyus@iiitd.ac.in>, linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Kapil Vaswani <kapil@presceralabs.ai>,
stable@vger.kernel.org
Subject: Re: [PATCH wireless 1/2] wifi: mac80211: do not copy the mesh RSN IE twice into the beacon
Date: Tue, 24 Nov 2026 15:02:16 +0100 [thread overview]
Message-ID: <ac39fb1720fc03069317f8a74aa0f34d86db2e30.camel@sipsolutions.net> (raw)
In-Reply-To: <20261124003526.78471-2-piyus@iiitd.ac.in>
On Tue, 2026-11-24 at 06:05 +0530, Piyus Kedia wrote:
> 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.
>
Please write a better commit message. This is *mostly* just stating the
obvious, as LLMs always do.
johannes
next prev parent reply other threads:[~2026-11-24 14:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 0:35 [BUG] wifi: mac80211: one JOIN_MESH writes 479 bytes past the mesh beacon, because the extra IE blob is budgeted once and copied twice Piyus Kedia
2026-11-24 0:35 ` [PATCH wireless 1/2] wifi: mac80211: do not copy the mesh RSN IE twice into the beacon Piyus Kedia
2026-11-24 14:02 ` Johannes Berg [this message]
2026-11-24 0:35 ` [PATCH wireless 2/2] wifi: mac80211: widen the mesh IE offsets a u8 cannot hold Piyus Kedia
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ac39fb1720fc03069317f8a74aa0f34d86db2e30.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=kapil@presceralabs.ai \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=piyus@iiitd.ac.in \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®