From: Tristan Madani <tristmd@gmail.com>
To: Arend van Spriel <arend.vanspriel@broadcom.com>
Cc: Franky Lin <frankyl@broadcom.com>,
linux-wireless@vger.kernel.org, brcm80211@lists.linux.dev,
brcm80211-dev-list.pdl@broadcom.com, stable@vger.kernel.org,
Tristan Madani <tristan@talencesecurity.com>
Subject: [PATCH wireless v3] wifi: brcmfmac: zero-pad SDIO write buffer to 4-byte boundary
Date: Thu, 26 Nov 2026 21:24:16 +0000 [thread overview]
Message-ID: <20261126212416.1397643-1-tristmd@gmail.com> (raw)
From: Tristan Madani <tristan@talencesecurity.com>
brcmf_sdiod_skbuff_write() rounds skb->len up to the next 4-byte
boundary and passes the larger size to sdio_memcpy_toio(). The 1-3
padding bytes beyond skb->data + skb->len are sent to the wireless
device uninitialized.
The SDPCM header carries the original (unpadded) frame length, so the
device discards the padding. The window is therefore limited to the
local SDIO bus.
Ensure sufficient tailroom exists for the alignment padding before
zeroing it. If the skb tailroom is too short, expand the head to
make room.
Fixes: 78b3f1c5be8f ("brcmfmac: replace brcmf_sdioh_request_buffer with brcmf_sdio_buffrw")
Cc: stable@vger.kernel.org
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
---
Changes in v3:
- Check skb_tailroom() before zeroing the padding; if the skb
tailroom is too short, call pskb_expand_head() to make room
(Arend van Spriel)
- Use the correct Fixes tag: the 4-byte rounding was introduced
by 78b3f1c5be8f, not by the later function split (Arend van Spriel)
- Add impact note: SDPCM header carries unpadded length, so device
discards the extra bytes and the window is local SDIO bus only
(Arend van Spriel)
Supersedes: f935e48bd9a6 ("wifi: brcmfmac: zero-pad SDIO write to
4-byte boundary")
Changes in v2:
- Original submission as part of [PATCH wireless 1/2] series
.../net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
index 71c2f99cdb711..e5068da9672cc 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
@@ -317,12 +317,23 @@ static int brcmf_sdiod_skbuff_write(struct brcmf_sdio_dev *sdiodev,
struct sk_buff *skb)
{
unsigned int req_sz;
+ unsigned int pad;
int err;
/* Single skb use the standard mmc interface */
req_sz = skb->len + 3;
req_sz &= (uint)~3;
+ pad = req_sz - skb->len;
+ if (pad > 0) {
+ if (skb_tailroom(skb) < pad) {
+ err = pskb_expand_head(skb, 0, pad, GFP_ATOMIC);
+ if (err)
+ return err;
+ }
+ memset(skb->data + skb->len, 0, pad);
+ }
+
err = sdio_memcpy_toio(func, addr, ((u8 *)(skb->data)), req_sz);
if (err == -ENOMEDIUM)
--
2.47.3
reply other threads:[~2026-11-26 21:24 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=20261126212416.1397643-1-tristmd@gmail.com \
--to=tristmd@gmail.com \
--cc=arend.vanspriel@broadcom.com \
--cc=brcm80211-dev-list.pdl@broadcom.com \
--cc=brcm80211@lists.linux.dev \
--cc=frankyl@broadcom.com \
--cc=linux-wireless@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=tristan@talencesecurity.com \
/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