From: "Jérôme Pouiller" <jerome.pouiller@silabs.com>
To: linux-wireless@vger.kernel.org, Aamir Ahmed <elb12345@hotmail.co.uk>
Cc: gregkh@linuxfoundation.org, Aamir Ahmed <elb12345@hotmail.co.uk>
Subject: Re: [PATCH] wifi: wfx: validate num_tx_confs against HIF message length
Date: Mon, 07 Sep 2026 21:52:03 +0200 [thread overview]
Message-ID: <4973500.rnE6jSC6OK@nb0018864> (raw)
In-Reply-To: <AS8P251MB000103B16A46379DFADEDB21C8B22@AS8P251MB0001.EURP251.PROD.OUTLOOK.COM>
On Monday 7 September 2026 04:59:00 Central European Summer Time Aamir Ahmed wrote:
> wfx_hif_multi_tx_confirm() trusts the device-supplied
> num_tx_confs field without checking whether the HIF message
> is large enough to contain that many entries. A malformed
> or corrupted message with a large num_tx_confs value causes
> out-of-bounds reads from the tx_conf_payload flexible array.
>
> Validate that the HIF body is large enough for the fixed
> header and the claimed number of confirmation entries before
> iterating.
>
> Fixes: 9bca45f3d692 ("staging: wfx: allow to send 802.11 frames")
> Signed-off-by: Aamir Ahmed <elb12345@hotmail.co.uk>
> ---
> drivers/net/wireless/silabs/wfx/hif_rx.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/silabs/wfx/hif_rx.c b/drivers/net/wireless/silabs/wfx/hif_rx.c
> index 64ca8acb8e4f..683fb67916c8 100644
> --- a/drivers/net/wireless/silabs/wfx/hif_rx.c
> +++ b/drivers/net/wireless/silabs/wfx/hif_rx.c
> @@ -62,9 +62,15 @@ static int wfx_hif_multi_tx_confirm(struct wfx_dev *wdev,
> const struct wfx_hif_msg *hif, const void *buf)
> {
> const struct wfx_hif_cnf_multi_transmit *body = buf;
> + int hif_body_len = le16_to_cpu(hif->len) - sizeof(*hif);
> int i;
>
> - WARN(body->num_tx_confs <= 0, "corrupted message");
> + if (hif_body_len < (int)sizeof(*body) ||
> + body->num_tx_confs > (hif_body_len - sizeof(*body)) /
> + sizeof(body->tx_conf_payload[0])) {
> + dev_err(wdev->dev, "corrupted multi tx confirm\n");
> + return -EINVAL;
> + }
body->num_tx_confs is already used in rx_helper(). So, the
error detection happens to late.
Until now, I have considered the device semi-trusted, so skipping this
test does not shock me.
(I tend to prefer the readability of the code rather to clutter it with
plenty of error paths impossible to reach and impossible to test)
--
Jérôme Pouiller
next prev parent reply other threads:[~2026-09-07 19:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-07 2:59 [PATCH] wifi: wfx: validate num_tx_confs against HIF message length Aamir Ahmed
2026-09-07 19:52 ` Jérôme Pouiller [this message]
2026-09-08 1:15 ` Aamir Ahmed
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=4973500.rnE6jSC6OK@nb0018864 \
--to=jerome.pouiller@silabs.com \
--cc=elb12345@hotmail.co.uk \
--cc=gregkh@linuxfoundation.org \
--cc=linux-wireless@vger.kernel.org \
/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