Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] wifi: wfx: validate num_tx_confs against HIF message length
@ 2026-09-07  2:59 Aamir Ahmed
  2026-09-07 19:52 ` Jérôme Pouiller
  0 siblings, 1 reply; 3+ messages in thread
From: Aamir Ahmed @ 2026-09-07  2:59 UTC (permalink / raw)
  To: jerome.pouiller, linux-wireless; +Cc: gregkh, Aamir Ahmed

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;
+	}
 	for (i = 0; i < body->num_tx_confs; i++)
 		wfx_tx_confirm_cb(wdev, &body->tx_conf_payload[i]);
 	return 0;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-08  1:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2026-09-08  1:15   ` Aamir Ahmed

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox