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, Aamir Ahmed <elb12345@hotmail.co.uk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH wireless v2] wifi: wfx: validate MIB read length before copying to caller
Date: Wed, 16 Sep 2026 10:37:28 -0700	[thread overview]
Message-ID: <3635048.QJadu78ljV@nb0018864> (raw)
In-Reply-To: <AS8P251MB000155034FC391A2A54B9803C8BD2@AS8P251MB0001.EURP251.PROD.OUTLOOK.COM>

On Saturday 12 September 2026 06:47:55 Pacific Daylight Time Aamir Ahmed wrote:
> wfx_hif_read_mib() copies reply->length bytes from the firmware
> response into the caller-provided buffer without checking that
> reply->length does not exceed val_len. A firmware response with
> a length field larger than expected overruns the caller buffer and
> reads past the end of the reply allocation.
> 
> Replace the dead -ENOMEM check with an active validation that
> reply->length fits within val_len before the memcpy.
> 
> Fixes: f95a29d40782 ("staging: wfx: add HIF commands helpers")
> Assisted-by: LLM

Usually, you have to specify the name of the tool and the model used. eg.:

    Assisted-by: Codex:GPT-5

[...]
> diff --git a/drivers/net/wireless/silabs/wfx/hif_tx.c b/drivers/net/wireless/silabs/wfx/hif_tx.c
> index 9f403d275cb1..9efb108bd877 100644
> --- a/drivers/net/wireless/silabs/wfx/hif_tx.c
> +++ b/drivers/net/wireless/silabs/wfx/hif_tx.c
> @@ -207,9 +207,11 @@ int wfx_hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, void *val, si
>                 dev_warn(wdev->dev, "%s: confirmation mismatch request\n", __func__);
>                 ret = -EIO;
>         }
> -       if (ret == -ENOMEM)
> +       if (!ret && le16_to_cpu(reply->length) > val_len) {
>                 dev_err(wdev->dev, "buffer is too small to receive %s (%zu < %d)\n",
>                         wfx_get_mib_name(mib_id), val_len, le16_to_cpu(reply->length));
> +               ret = -EIO;
> +       }
>         if (!ret)
>                 memcpy(val, &reply->mib_data, le16_to_cpu(reply->length));
>         else
> 
> base-commit: df2908090cda368b01ff43709f51890076c56157

Was this line generated by git-send-email?

-- 
Jérôme Pouiller



  reply	other threads:[~2026-09-16 17:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-12 13:47 Aamir Ahmed
2026-09-16 17:37 ` Jérôme Pouiller [this message]
2026-09-16 18:37   ` 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=3635048.QJadu78ljV@nb0018864 \
    --to=jerome.pouiller@silabs.com \
    --cc=elb12345@hotmail.co.uk \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®