mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jérôme Pouiller" <jerome.pouiller@silabs.com>
To: linux-wireless@vger.kernel.org, Tristan Madani <tristmd@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	Tristan Madani <tristan@talencesecurity.com>
Subject: Re: [PATCH wireless] wifi: wfx: validate num_tx_confs against message length
Date: Wed, 04 Nov 2026 08:38:26 +0100	[thread overview]
Message-ID: <6204727.CvnuH1ECHv@nb0018864> (raw)
In-Reply-To: <20261103232650.13350-1-tristmd@gmail.com>

On Wednesday 4 November 2026 00:26:50 Central European Standard Time Tristan Madani wrote:
> From: Tristan Madani <tristan@talencesecurity.com>
> 
> wfx_hif_multi_tx_confirm() iterates over the tx_conf_payload flexible
> array based on body->num_tx_confs, but does not check that the message
> is actually large enough to contain that many entries. Add a check
> comparing num_tx_confs against the available message payload before
> iterating.
> 
> Fixes: 9bca45f3d692 ("staging: wfx: allow to send 802.11 frames")
> Cc: stable@vger.kernel.org
> Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
> ---
>  drivers/net/wireless/silabs/wfx/hif_rx.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/net/wireless/silabs/wfx/hif_rx.c b/drivers/net/wireless/silabs/wfx/hif_rx.c
> index 64ca8acb8e4f2..42417db66c128 100644
> --- a/drivers/net/wireless/silabs/wfx/hif_rx.c
> +++ b/drivers/net/wireless/silabs/wfx/hif_rx.c
> @@ -62,8 +62,17 @@ 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;
> +       size_t needed;
>         int i;
> 
> +       needed = sizeof(*body) +
> +                body->num_tx_confs * sizeof(body->tx_conf_payload[0]);
> +       if (le16_to_cpu(hif->len) < sizeof(*hif) + needed) {
> +               dev_warn(wdev->dev, "invalid num_tx_confs %d for msg length %d\n",
> +                        body->num_tx_confs, le16_to_cpu(hif->len));
> +               return -EINVAL;
> +       }
> +
[...]

body->num_tx_confs is already used in rx_helper(). So, the
error detection happens to late.

-- 
Jérôme Pouiller



      reply	other threads:[~2026-11-04  7:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 23:26 Tristan Madani
2026-11-04  7:38 ` Jérôme Pouiller [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=6204727.CvnuH1ECHv@nb0018864 \
    --to=jerome.pouiller@silabs.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=stable@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

all inboxes | Powered by JetHome®