From: Tristan Madani <tristmd@gmail.com>
To: "Jérôme Pouiller" <jerome.pouiller@silabs.com>,
linux-wireless@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Tristan Madani <tristan@talencesecurity.com>
Subject: [PATCH wireless] wifi: wfx: validate num_tx_confs against message length
Date: Tue, 3 Nov 2026 23:26:50 +0000 [thread overview]
Message-ID: <20261103232650.13350-1-tristmd@gmail.com> (raw)
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;
+ }
+
WARN(body->num_tx_confs <= 0, "corrupted message");
for (i = 0; i < body->num_tx_confs; i++)
wfx_tx_confirm_cb(wdev, &body->tx_conf_payload[i]);
--
2.47.3
next reply other threads:[~2026-11-03 23:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 23:26 Tristan Madani [this message]
2026-11-04 7:38 ` [PATCH wireless] wifi: wfx: validate num_tx_confs against message length Jérôme Pouiller
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=20261103232650.13350-1-tristmd@gmail.com \
--to=tristmd@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jerome.pouiller@silabs.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=tristan@talencesecurity.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