From: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
To: Tristan Madani <tristmd@gmail.com>,
Loic Poulain <loic.poulain@oss.qualcomm.com>
Cc: Johannes Berg <johannes@sipsolutions.net>,
wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org,
Tristan Madani <tristan@talencesecurity.com>
Subject: Re: [PATCH v3 1/3] wifi: wcn36xx: fix heap overflow from oversized firmware HAL response
Date: Thu, 4 Jun 2026 18:43:33 -0700 [thread overview]
Message-ID: <7c01afaf-5530-4ca2-b2f3-dbe95ddfe6ee@oss.qualcomm.com> (raw)
In-Reply-To: <20260421135018.352774-2-tristmd@gmail.com>
On 4/21/2026 6:50 AM, Tristan Madani wrote:
> From: Tristan Madani <tristan@talencesecurity.com>
>
> The firmware response dispatcher copies all synchronous HAL responses
> into the 4096-byte hal_buf without validating the response length. A
> response exceeding WCN36XX_HAL_BUF_SIZE causes a heap buffer overflow
> with firmware-controlled content.
>
> Add a bounds check on the response length.
>
> Fixes: 8e84c2582169 ("wcn36xx: mac80211 driver for Qualcomm WCN3660/WCN3680 hardware")
> Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
> ---
> Changes in v3:
> - Regenerated from wireless-next with proper git format-patch to
> produce valid index hashes (v2 had post-processed index lines).
>
> Changes in v2:
> - No code changes from v1.
>
> drivers/net/wireless/ath/wcn36xx/smd.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c
> index 813553edcb789..f65328329f4f0 100644
> --- a/drivers/net/wireless/ath/wcn36xx/smd.c
> +++ b/drivers/net/wireless/ath/wcn36xx/smd.c
> @@ -3293,6 +3293,10 @@ int wcn36xx_smd_rsp_process(struct rpmsg_device *rpdev,
> case WCN36XX_HAL_EXIT_IMPS_RSP:
> case WCN36XX_HAL_UPDATE_CHANNEL_LIST_RSP:
> case WCN36XX_HAL_ADD_BCN_FILTER_RSP:
> + if (len > WCN36XX_HAL_BUF_SIZE) {
> + wcn36xx_warn("HAL response too large: %d\n", len);
> + break;
> + }
> memcpy(wcn->hal_buf, buf, len);
> wcn->hal_rsp_len = len;
> complete(&wcn->hal_rsp_compl);
AI review points out that this logic will bypass the complete() meaning
callers waiting for completion will be stuck (either forever or until the
specified timeout expires). It proposes setting len = 0 instead of break and
having each waiter deal with the issue that wcn->hal_rsp_len is 0.
Further probing gave the observation that there is only one waiter
wcn36xx_smd_send_and_wait() so there isn't a "wait forever" scenario.
It also confirmed that setting wcn->hal_rsp_len = 0 would subsequently be
processed by wcn36xx_smd_rsp_status_check() which would return -EIO due to len
< sizeof(header) + sizeof(status_rsp).
So setting len = 0 and still calling complete() would avoid the timeout and
would cause -EIO vs -ETIME to be propagated.
I can go either way with this since it is not expected to occur.
/jeff
next prev parent reply other threads:[~2026-06-05 1:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-21 13:50 [PATCH v3 0/3] wifi: wcn36xx: firmware trust boundary hardening Tristan Madani
2026-04-21 13:50 ` [PATCH v3 1/3] wifi: wcn36xx: fix heap overflow from oversized firmware HAL response Tristan Madani
2026-05-07 21:29 ` Loic Poulain
2026-06-05 1:43 ` Jeff Johnson [this message]
2026-06-05 20:11 ` Loic Poulain
2026-04-21 13:50 ` [PATCH v3 2/3] wifi: wcn36xx: fix OOB read from firmware count in PRINT_REG_INFO indication Tristan Madani
2026-06-05 21:38 ` Jeff Johnson
2026-04-21 13:50 ` [PATCH v3 3/3] wifi: wcn36xx: fix OOB read from short trigger BA firmware response Tristan Madani
2026-04-21 14:03 ` Loic Poulain
2026-05-07 21:35 ` Loic Poulain
2026-06-06 15:54 ` [PATCH v3 0/3] wifi: wcn36xx: firmware trust boundary hardening Jeff Johnson
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=7c01afaf-5530-4ca2-b2f3-dbe95ddfe6ee@oss.qualcomm.com \
--to=jeff.johnson@oss.qualcomm.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=loic.poulain@oss.qualcomm.com \
--cc=tristan@talencesecurity.com \
--cc=tristmd@gmail.com \
--cc=wcn36xx@lists.infradead.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