From: Chad Aldreda <ca@modelmiser.com>
To: Arend van Spriel <arend.vanspriel@broadcom.com>
Cc: Johannes Berg <johannes@sipsolutions.net>,
linux-wireless@vger.kernel.org, brcm80211@lists.linux.dev,
brcm80211-dev-list.pdl@broadcom.com,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: [PATCH wireless] wifi: brcmfmac: fix join parameter length in IBSS join
Date: Sat, 21 Nov 2026 09:27:54 +0000 [thread overview]
Message-ID: <20261121092746.2917397-2-ca@modelmiser.com> (raw)
brcmf_cfg80211_join_ibss() builds the length of the SET_SSID payload in
steps. It starts with the SSID record (36 bytes), adds
BRCMF_ASSOC_PARAMS_FIXED_SIZE (14) when a BSSID is given, and adds
sizeof(join_params.params_le) (16) when the channel is fixed. With both a
BSSID and a fixed channel the result is 66, but struct brcmf_join_params
is 52 bytes (sizes as on x86-64, where __le32 is 4-byte aligned). The
length is passed unchanged to the protocol layer, which copies that many
bytes from the on-stack record (brcmf_proto_bcdc_msg(),
brcmf_msgbuf_tx_ioctl()), so 14 bytes of kernel stack beyond it are sent
to the firmware.
When the channel is fixed the whole record is in use whether or not a
BSSID was given, so set the length to sizeof(join_params) in that branch.
The other three cases (36, 50 and 52 bytes) are unchanged.
The double count dates from the commit that added this calculation: the
BSSID case counted WL_ASSOC_PARAMS_FIXED_SIZE, and the existing
wl_ch_to_chanspec(), which that commit called after the BSSID case,
added WL_ASSOC_PARAMS_FIXED_SIZE plus one chanspec again.
Fixes: 69274f020a92 ("staging: brcm80211: Fixed ibss join/leave functionality in brcmfmac driver")
Cc: stable@vger.kernel.org
Signed-off-by: Chad Aldreda <ca@modelmiser.com>
---
Not run on hardware, and no reproducer was run. Reaching the line
needs a brcmfmac device in IBSS mode and a join with both a BSSID and
a fixed frequency:
iw dev wlan0 ibss join <ssid> <freq> fixed-freq <bssid>
The four lengths (36, 50, 52, 66) were checked at compile time against
the driver's headers on x86-64, and cfg80211.o builds with W=1.
Not checked: that firmware accepts 52 bytes in this case. It is the
length the driver already sends for a fixed channel without a BSSID,
from the SET_SSID fallback in brcmf_cfg80211_connect() when a channel
is known, and from the AP start and stop paths.
Also not checked: on msgbuf the same length bounds the copy of the
firmware's response back into the record (brcmf_msgbuf_query_dcmd()),
so a response longer than 52 bytes would be written up to 14 bytes
past it. Whether firmware returns data for SET_SSID is not known here.
The BSSID-only length (50) is left alone to keep this a pure fix.
Based on wireless/main dcf495789037. It also applies unchanged to
wireless-next/main e1dd8486807c, where the length goes through
brcmf_set_ssid() (39cae1c203a3) and is still passed on as is when the
firmware does not use versioned join requests.
Tools: the over-length was flagged by an AI model (Grok 4.7) asked to
check notes on the driver's firmware interface against the source,
and confirmed by an AI assistant (Claude Fable 5.2) reading the code.
The patch, this description, the size check and the build were done
by that assistant.
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 46714d871260..9e5955a98051 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -1901,7 +1901,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
join_params.params_le.chanspec_list[0] =
cpu_to_le16(chanspec);
join_params.params_le.chanspec_num = cpu_to_le32(1);
- join_params_size += sizeof(join_params.params_le);
+ join_params_size = sizeof(join_params);
}
/* set channel for starter */
base-commit: dcf495789037ab78d8ddf5844239cf85d92ac5f1
--
2.43.0
reply other threads:[~2026-11-21 9:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261121092746.2917397-2-ca@modelmiser.com \
--to=ca@modelmiser.com \
--cc=arend.vanspriel@broadcom.com \
--cc=brcm80211-dev-list.pdl@broadcom.com \
--cc=brcm80211@lists.linux.dev \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.