* [PATCH wireless] wifi: brcmfmac: ensure tailroom before zero-padding SDIO writes
@ 2026-12-02 14:44 Tristan Madani
0 siblings, 0 replies; only message in thread
From: Tristan Madani @ 2026-12-02 14:44 UTC (permalink / raw)
To: Arend van Spriel
Cc: linux-wireless, brcm80211, brcm80211-dev-list.pdl, stable,
Tristan Madani
From: Tristan Madani <tristan@talencesecurity.com>
brcmf_sdiod_skbuff_write() zero-fills up to 3 bytes past skb->len
before passing the aligned size to sdio_memcpy_toio(). When the skb
has less tailroom than the padding needed, the memset writes past
the allocated buffer.
Check skb_tailroom() and call pskb_expand_head() to extend the skb
when necessary. This is always called from thread context so
GFP_KERNEL is appropriate.
Fixes: f935e48bd9a60 ("wifi: brcmfmac: zero-pad SDIO write to 4-byte boundary")
Cc: stable@vger.kernel.org
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
---
Compile-tested only; no SDIO hardware available for runtime testing.
The tailroom expansion pattern matches brcmf_sdio_txpkt_prep_sg()
in the same driver's SDIO TX path.
.../wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
index c6dd4148a44ce..315e64ee206f1 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
@@ -323,8 +323,16 @@ static int brcmf_sdiod_skbuff_write(struct brcmf_sdio_dev *sdiodev,
req_sz = skb->len + 3;
req_sz &= (uint)~3;
- if (req_sz > skb->len)
- memset(skb->data + skb->len, 0, req_sz - skb->len);
+ if (req_sz > skb->len) {
+ unsigned int pad = req_sz - skb->len;
+
+ if (skb_tailroom(skb) < pad) {
+ err = pskb_expand_head(skb, 0, pad, GFP_KERNEL);
+ if (err)
+ return err;
+ }
+ memset(skb->data + skb->len, 0, pad);
+ }
err = sdio_memcpy_toio(func, addr, ((u8 *)(skb->data)), req_sz);
--
2.47.3
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-12-02 14:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 14:44 [PATCH wireless] wifi: brcmfmac: ensure tailroom before zero-padding SDIO writes Tristan Madani
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox