Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH v2 wireless] wifi: mwifiex: zero-pad SDIO TX buffer to block-aligned transfer length
@ 2026-11-24 21:07 Tristan Madani
  0 siblings, 0 replies; only message in thread
From: Tristan Madani @ 2026-11-24 21:07 UTC (permalink / raw)
  To: Brian Norris, Francesco Dolcini
  Cc: Jeff Chen, Bing Zhao, linux-wireless, stable, Tristan Madani

From: Tristan Madani <tristan@talencesecurity.com>

mwifiex_sdio_host_to_card() rounds up the packet length to
MWIFIEX_SDIO_BLOCK_SIZE (256 bytes) for SDIO block-mode transfers.
When the original skb data is shorter than the rounded-up length, the
SDIO controller reads past the valid payload into uninitialized skb
tailroom, transmitting stale data to the wireless device firmware.

Zero the padding bytes starting at skb_tail_pointer() without
extending skb->len, so that reused buffers such as adapter->sleep_cfm
keep their original length across sends. When tailroom is smaller than
the padding, zero whatever is available.

Fixes: 5e6e3a92b9a4 ("wireless: mwifiex: initial commit for Marvell mwifiex driver")
Cc: stable@vger.kernel.org
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
---
v2: use memset(skb_tail_pointer()) instead of skb_put_zero() to avoid
permanently extending skb->len on reused buffers like sleep_cfm. Use
min_t() to zero whatever tailroom is available when it is smaller than
the padding. (Jeff Chen)

Build tested: x86_64 defconfig + CONFIG_MWIFIEX=m + CONFIG_MWIFIEX_SDIO=m,
gcc 14.2, W=1, 0 warnings.

 drivers/net/wireless/marvell/mwifiex/sdio.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c
index 417dc2649b99c..d097efb2afbee 100644
--- a/drivers/net/wireless/marvell/mwifiex/sdio.c
+++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
@@ -2386,6 +2386,11 @@ static int mwifiex_sdio_host_to_card(struct mwifiex_adapter *adapter,
 	/* Transfer data to card */
 	pkt_len = buf_block_len * blk_size;
 
+	if (pkt_len > skb->len)
+		memset(skb_tail_pointer(skb), 0,
+		       min_t(unsigned int, pkt_len - skb->len,
+			     skb_tailroom(skb)));
+
 	if (tx_param)
 		ret = mwifiex_host_to_card_mp_aggr(adapter, payload, pkt_len,
 						   port, tx_param->next_pkt_len
-- 
2.47.3


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-24 21:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 21:07 [PATCH v2 wireless] wifi: mwifiex: zero-pad SDIO TX buffer to block-aligned transfer length Tristan Madani

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox