[PATCH wireless 2/2] wifi: mac80211: widen the mesh IE offsets a u8 cannot hold

From: Piyus Kedia

Date: Mon Nov 23 2026 - 19:36:02 EST


The extra IE blob a mesh join carries is bounded by IEEE80211_MAX_DATA_LEN,
2304 bytes, and ifmsh->ie_len is a size_t. Two places that walk it use u8
for values derived from that length.

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;

ieee80211_ie_split_vendor() returns a size_t. A blob whose vendor IEs
begin past byte 255 truncates the offset to a smaller value, so the copy
starts in the middle of an earlier element and emits bytes that are not
vendor IEs at all; len truncates with it.

mesh_add_rsn_ie():

u8 len = 0;
...
len = data[1] + 2;

An element's length byte reaches 255, so this is 257 for the largest RSN IE
and truncates to 1 - the IE is then emitted as a two-byte stub, and a
secure mesh advertises a malformed RSN element.

Neither is a memory-safety problem: the preceding patch makes the two
builders cover disjoint ranges, so the beacon's single ifmsh->ie_len budget
holds whatever these values are. Use types that can hold them.

How this was found: alongside the out-of-bounds write fixed in the
preceding patch, by AI-driven fuzzing built on top of syzkaller, then
checked by hand against the code.

Fixes: 2b5e19677592 ("mac80211: cache mesh beacon")
Signed-off-by: Kapil Vaswani <kapil@xxxxxxxxxxxxxxx>
Signed-off-by: Piyus Kedia <piyus@xxxxxxxxxxx>
---
net/mac80211/mesh.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index eb54bd98f282..4ab776e174d9 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -354,7 +354,7 @@ int mesh_add_vendor_ies(struct ieee80211_sub_if_data *sdata,
struct sk_buff *skb)
{
struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
- u8 offset, len;
+ size_t offset, len;
const u8 *data;

if (!ifmsh->ie || !ifmsh->ie_len)
@@ -377,9 +377,9 @@ 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;
- u8 len = 0;
const u8 *data;
size_t prefix;
+ unsigned int len;

if (!ifmsh->ie || !ifmsh->ie_len)
return 0;
--
2.34.1