From: Tristan Madani <tristmd@gmail.com>
To: Brian Norris <briannorris@chromium.org>,
Francesco Dolcini <francesco@dolcini.it>
Cc: Jeff Chen <jeff.chen_1@nxp.com>, Bing Zhao <bzhao@marvell.com>,
linux-wireless@vger.kernel.org, stable@vger.kernel.org,
Tristan Madani <tristan@talencesecurity.com>
Subject: [PATCH v2 wireless] wifi: mwifiex: zero-pad SDIO TX buffer to block-aligned transfer length
Date: Tue, 24 Nov 2026 21:07:01 +0000 [thread overview]
Message-ID: <20261124210701.467325-1-tristmd@gmail.com> (raw)
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
reply other threads:[~2026-11-24 21:07 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=20261124210701.467325-1-tristmd@gmail.com \
--to=tristmd@gmail.com \
--cc=briannorris@chromium.org \
--cc=bzhao@marvell.com \
--cc=francesco@dolcini.it \
--cc=jeff.chen_1@nxp.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