From: jeff.chen_1@oss.nxp.com
To: Tristan Madani <tristmd@gmail.com>
Cc: Jeff Chen <jeff.chen_1@oss.nxp.com>,
Brian Norris <briannorris@chromium.org>,
Francesco Dolcini <francesco@dolcini.it>,
linux-wireless@vger.kernel.org,
Tristan Madani <tristan@talencesecurity.com>
Subject: Re: [PATCH wireless] wifi: mwifiex: zero-pad SDIO TX buffer to block-aligned transfer length
Date: Tue, 24 Nov 2026 14:11:46 +0800 [thread overview]
Message-ID: <20261124061146.801381-1-jeff.chen_1@oss.nxp.com> (raw)
In-Reply-To: <20261102221530.3469388-1-tristan@talencesecurity.com>
From: Jeff Chen <jeff.chen_1@oss.nxp.com>
On Mon, Nov 02, 2026 at 10:15:30 PM +0000, Tristan Madani wrote:
> 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.
>
> Extend the skb to the block-aligned transfer length and zero the
> padding when sufficient tailroom is available, preventing the data
> leak.
>
> Fixes: 5e6e3a92b9a4 ("wireless: mwifiex: initial commit for Marvell mwifiex driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
> ---
> drivers/net/wireless/marvell/mwifiex/sdio.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c
> index f039d6f19183a..c46a048cc961a 100644
> --- a/drivers/net/wireless/marvell/mwifiex/sdio.c
> +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
> @@ -2386,6 +2386,9 @@ 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 && skb_tailroom(skb) >= pkt_len - skb->len)
> + memset(skb_put(skb, pkt_len - skb->len), 0, pkt_len - skb->len);
> +
> if (tx_param)
> ret = mwifiex_host_to_card_mp_aggr(adapter, payload, pkt_len,
> port, tx_param->next_pkt_len
The leak is real, but there are two problems:
1. When the skb does not have enough tailroom, the padding is not
zeroed.
2. skb_put() changes skb->len permanently. adapter->sleep_cfm is
allocated once and reused, so after the first send its SDIO
header length becomes the padded length.
Could you zero the padding without changing skb->len, and also handle
the case where the tailroom is too small? For example, when there is
enough tailroom:
memset(skb_tail_pointer(skb), 0, pkt_len - skb->len);
prev parent reply other threads:[~2026-11-24 6:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 22:15 [PATCH wireless] wifi: mwifiex: zero-pad SDIO TX buffer to block-aligned transfer length Tristan Madani
2026-11-24 6:11 ` jeff.chen_1 [this message]
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=20261124061146.801381-1-jeff.chen_1@oss.nxp.com \
--to=jeff.chen_1@oss.nxp.com \
--cc=briannorris@chromium.org \
--cc=francesco@dolcini.it \
--cc=linux-wireless@vger.kernel.org \
--cc=tristan@talencesecurity.com \
--cc=tristmd@gmail.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