From: Francesco Dolcini <francesco@dolcini.it>
To: Pengpeng Hou <pengpeng@iscas.ac.cn>
Cc: Brian Norris <briannorris@chromium.org>,
Francesco Dolcini <francesco@dolcini.it>,
Kees Cook <kees@kernel.org>,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] wifi: mwifiex: validate scan TLV result arrays
Date: Wed, 15 Jul 2026 16:17:37 +0200 [thread overview]
Message-ID: <20260715141737.GD56330@francesco-nb> (raw)
In-Reply-To: <20260706092654.79403-1-pengpeng@iscas.ac.cn>
On Mon, Jul 06, 2026 at 05:26:54PM +0800, Pengpeng Hou wrote:
> mwifiex_ret_802_11_scan() indexes TSF and channel-band TLV
> arrays by the reported number of BSS result sets.
>
> Ignore TSF or channel-band TLVs whose payload length cannot provide one
> entry per reported BSS set.
>
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Was this tested?
> ---
> drivers/net/wireless/marvell/mwifiex/scan.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/net/wireless/marvell/mwifiex/scan.c b/drivers/net/wireless/marvell/mwifiex/scan.c
> index 97c0ec3b822e..7416756ada3b 100644
> --- a/drivers/net/wireless/marvell/mwifiex/scan.c
> +++ b/drivers/net/wireless/marvell/mwifiex/scan.c
> @@ -2165,6 +2165,15 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
> (struct mwifiex_ie_types_data **)
> &chan_band_tlv);
>
> + if (tsf_tlv &&
> + le16_to_cpu(tsf_tlv->header.len) / TSF_DATA_SIZE <
> + scan_rsp->number_of_sets)
> + tsf_tlv = NULL;
> + if (chan_band_tlv &&
> + le16_to_cpu(chan_band_tlv->header.len) /
> + sizeof(*chan_band_tlv->chan_band_param) < scan_rsp->number_of_sets)
> + chan_band_tlv = NULL;
> +
If something like that happen we should return an error, and return from
the function
a few lines before we do
if (scan_rsp->number_of_sets > MWIFIEX_MAX_AP) {
mwifiex_dbg(adapter, ERROR,
"SCAN_RESP: too many AP returned (%d)\n",
scan_rsp->number_of_sets);
ret = -1;
goto check_next_scan;
}
why not doing something similar when this buffer from the fw is
corrupted?
Francesco
prev parent reply other threads:[~2026-07-15 14:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-06 9:26 [PATCH] wifi: mwifiex: validate scan TLV result arrays Pengpeng Hou
2026-07-15 14:17 ` Francesco Dolcini [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=20260715141737.GD56330@francesco-nb \
--to=francesco@dolcini.it \
--cc=briannorris@chromium.org \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=pengpeng@iscas.ac.cn \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.