* [PATCH wireless 0/2] wifi: zero-pad SDIO writes to avoid leaking heap data @ 2026-11-02 12:23 Tristan Madani 2026-11-02 12:23 ` [PATCH wireless 1/2] wifi: brcmfmac: zero-pad SDIO write to 4-byte boundary Tristan Madani 2026-11-02 12:23 ` [PATCH wireless 2/2] wifi: rsi: zero-pad SDIO TX to block boundary Tristan Madani 0 siblings, 2 replies; 5+ messages in thread From: Tristan Madani @ 2026-11-02 12:23 UTC (permalink / raw) To: linux-wireless Cc: arend.vanspriel, brcm80211, brcm80211-dev-list.pdl, fariyaf, linville, kvalo, linux-kernel, Tristan Madani From: Tristan Madani <tristan@talencesecurity.com> Several wireless drivers round up the length passed to sdio_memcpy_toio() / sdio_writesb() for alignment purposes but do not clear the padding bytes. The SDIO controller then reads past the original buffer into adjacent heap memory, sending stale kernel data to the wireless device. Fix brcmfmac (4-byte alignment) and rsi (block alignment) by zero-filling the gap before the write. A third patch for rtw88 hits the same class of bug but needs a rebase and will follow separately. Tristan Madani (2): wifi: brcmfmac: zero-pad SDIO write to 4-byte boundary wifi: rsi: zero-pad SDIO TX to block boundary drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 3 +++ drivers/net/wireless/rsi/rsi_91x_sdio.c | 3 +++ 2 files changed, 6 insertions(+) -- 2.47.3 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH wireless 1/2] wifi: brcmfmac: zero-pad SDIO write to 4-byte boundary 2026-11-02 12:23 [PATCH wireless 0/2] wifi: zero-pad SDIO writes to avoid leaking heap data Tristan Madani @ 2026-11-02 12:23 ` Tristan Madani 2026-11-17 14:04 ` Arend van Spriel 2026-11-26 12:52 ` Arend van Spriel 2026-11-02 12:23 ` [PATCH wireless 2/2] wifi: rsi: zero-pad SDIO TX to block boundary Tristan Madani 1 sibling, 2 replies; 5+ messages in thread From: Tristan Madani @ 2026-11-02 12:23 UTC (permalink / raw) To: linux-wireless Cc: arend.vanspriel, brcm80211, brcm80211-dev-list.pdl, fariyaf, linville, kvalo, linux-kernel, Tristan Madani, stable 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 extra bytes come from heap memory past skb->data, leaking stale kernel data to the wireless device. Zero-fill the padding before the SDIO write. Fixes: 8f13c87ccc49 ("brcmfmac: Split brcmf_sdiod_buffrw function up.") Cc: stable@vger.kernel.org Signed-off-by: Tristan Madani <tristan@talencesecurity.com> --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c index 71c2f99cdb711..c6dd4148a44ce 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c @@ -323,6 +323,9 @@ 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); + err = sdio_memcpy_toio(func, addr, ((u8 *)(skb->data)), req_sz); if (err == -ENOMEDIUM) -- 2.47.3 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH wireless 1/2] wifi: brcmfmac: zero-pad SDIO write to 4-byte boundary 2026-11-02 12:23 ` [PATCH wireless 1/2] wifi: brcmfmac: zero-pad SDIO write to 4-byte boundary Tristan Madani @ 2026-11-17 14:04 ` Arend van Spriel 2026-11-26 12:52 ` Arend van Spriel 1 sibling, 0 replies; 5+ messages in thread From: Arend van Spriel @ 2026-11-17 14:04 UTC (permalink / raw) To: Tristan Madani, linux-wireless Cc: brcm80211, brcm80211-dev-list.pdl, fariyaf, linville, kvalo, linux-kernel, Tristan Madani, stable On 02/11/2026 13:23, Tristan Madani wrote: > 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 > extra bytes come from heap memory past skb->data, leaking stale kernel > data to the wireless device. > > Zero-fill the padding before the SDIO write. > > Fixes: 8f13c87ccc49 ("brcmfmac: Split brcmf_sdiod_buffrw function up.") > Cc: stable@vger.kernel.org Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com> > Signed-off-by: Tristan Madani <tristan@talencesecurity.com> > --- > drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 3 +++ > 1 file changed, 3 insertions(+) ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH wireless 1/2] wifi: brcmfmac: zero-pad SDIO write to 4-byte boundary 2026-11-02 12:23 ` [PATCH wireless 1/2] wifi: brcmfmac: zero-pad SDIO write to 4-byte boundary Tristan Madani 2026-11-17 14:04 ` Arend van Spriel @ 2026-11-26 12:52 ` Arend van Spriel 1 sibling, 0 replies; 5+ messages in thread From: Arend van Spriel @ 2026-11-26 12:52 UTC (permalink / raw) To: Tristan Madani Cc: linux-wireless, fariyaf, linville, kvalo, brcm80211, brcm80211-dev-list.pdl, linux-kernel, Tristan Madani, stable On Mon, 2 Nov 2026 12:23:10 +0000, Tristan Madani <tristmd@gmail.com> wrote: > 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 > extra bytes come from heap memory past skb->data, leaking stale kernel > data to the wireless device. > > Zero-fill the padding before the SDIO write. > > Fixes: 8f13c87ccc49 ("brcmfmac: Split brcmf_sdiod_buffrw function up.") [...] > --- > drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 3 +++ > 1 file changed, 3 insertions(+) [...] > @@ -323,6 +323,9 @@ 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); > + > err = sdio_memcpy_toio(func, addr, ((u8 *)(skb->data)), req_sz); > > if (err == -ENOMEDIUM) The padding lies beyond skb->len, so this memset is only safe when skb_tailroom(skb) >= req_sz - skb->len, and nothing guarantees that for the skbs reaching this function (e.g. a data skb in the non-glom path). If the tailroom is short the memset overwrites skb_shared_info. Please check the tailroom (brcmf_sdio_txpkt_prep_sg() does so before it adds tail padding) and handle the short case, e.g. by expanding the tail. Also, the 4-byte rounding of the length predates the commit in the Fixes tag, which only split the function up. Please point the tag at the commit that introduced the rounding. The SDPCM header carries the unpadded frame length so the device should ignore the padding bytes; a word on the actual impact and how this was tested would be good. Regards, Arend ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH wireless 2/2] wifi: rsi: zero-pad SDIO TX to block boundary 2026-11-02 12:23 [PATCH wireless 0/2] wifi: zero-pad SDIO writes to avoid leaking heap data Tristan Madani 2026-11-02 12:23 ` [PATCH wireless 1/2] wifi: brcmfmac: zero-pad SDIO write to 4-byte boundary Tristan Madani @ 2026-11-02 12:23 ` Tristan Madani 1 sibling, 0 replies; 5+ messages in thread From: Tristan Madani @ 2026-11-02 12:23 UTC (permalink / raw) To: linux-wireless Cc: arend.vanspriel, brcm80211, brcm80211-dev-list.pdl, fariyaf, linville, kvalo, linux-kernel, Tristan Madani, stable From: Tristan Madani <tristan@talencesecurity.com> rsi_sdio_host_intf_write_pkt() rounds the packet length up to the SDIO block size and passes the larger length to rsi_sdio_write_register_multiple(). When the packet is not block-aligned, the SDIO controller reads past the original data into adjacent heap memory, leaking stale kernel data to the wireless device. Zero-fill the padding before the SDIO write. Fixes: dad0d04fa7ba ("rsi: Add RS9113 wireless driver") Cc: stable@vger.kernel.org Signed-off-by: Tristan Madani <tristan@talencesecurity.com> --- drivers/net/wireless/rsi/rsi_91x_sdio.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c index bfa386b820d89..8bfb08306d03c 100644 --- a/drivers/net/wireless/rsi/rsi_91x_sdio.c +++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c @@ -772,6 +772,9 @@ static int rsi_sdio_host_intf_write_pkt(struct rsi_hw *adapter, address = (num_blocks * block_size | (queueno << 12)); length = num_blocks * block_size; + if (length > len) + memset((u8 *)pkt + len, 0, length - len); + status = rsi_sdio_write_register_multiple(adapter, address, (u8 *)pkt, -- 2.47.3 ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-26 12:52 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2026-11-02 12:23 [PATCH wireless 0/2] wifi: zero-pad SDIO writes to avoid leaking heap data Tristan Madani 2026-11-02 12:23 ` [PATCH wireless 1/2] wifi: brcmfmac: zero-pad SDIO write to 4-byte boundary Tristan Madani 2026-11-17 14:04 ` Arend van Spriel 2026-11-26 12:52 ` Arend van Spriel 2026-11-02 12:23 ` [PATCH wireless 2/2] wifi: rsi: zero-pad SDIO TX to block boundary Tristan Madani
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®