All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Alexandre Rapaille" <arapaille@atlr-engineering.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH 3/3] wifi: wcn36xx: Stop waiting on a dead firmware during remove
Date: Wed, 18 Nov 2026 15:07:58 +0000	[thread overview]
Message-ID: <sashiko-outbox-221294@kernel.org> (raw)
In-Reply-To: <20261118-wcnss-series-v1-v1-3-a64d82e151bf@atlr-engineering.com>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] wcn36xx: use-after-free in wcn36xx_smd_rsp_process() [1]
--

commit d25ff402f91edcb95672f79f032ef8c6744c841f
Author: Alexandre Rapaille <arapaille@atlr-engineering.com>

wifi: wcn36xx: Stop waiting on a dead firmware during remove

This commit marks the firmware as dead when a HAL command times out
during driver removal so subsequent teardown commands fail immediately
with -ETIME instead of each waiting for HAL_MSG_TIMEOUT.

> diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
> index ad8a4bd910d2c..77a1029108554 100644
> --- a/drivers/net/wireless/ath/wcn36xx/main.c
> +++ b/drivers/net/wireless/ath/wcn36xx/main.c
> @@ -1651,6 +1651,7 @@ static void wcn36xx_remove(struct platform_device *pdev)
>  
>  	release_firmware(wcn->nv);
>  
> +	WRITE_ONCE(wcn->removing, true);
>  	ieee80211_unregister_hw(hw);
>  
>  	qcom_smem_state_put(wcn->tx_enable_state);

[Severity: Critical]
This problem wasn't introduced by this patch, but can a late firmware
response or indication trigger a use-after-free in
wcn36xx_smd_rsp_process() [1]?

During ieee80211_unregister_hw() (or when the interface is brought down),
wcn36xx_stop() calls wcn36xx_smd_stop() and wcn36xx_smd_close(), freeing
wcn->hal_buf and destroying wcn->hal_ind_wq while wcn->smd_channel remains
open until rpmsg_destroy_ept() runs later in wcn36xx_remove():

CPU0                              CPU1
wcn36xx_stop()
  wcn36xx_smd_stop()
    ...                           wcn36xx_smd_rsp_process()
  wcn36xx_smd_close()
    destroy_workqueue(wcn->hal_ind_wq)
    kfree(wcn->hal_buf)
                                    memcpy(wcn->hal_buf, buf, len)
                                      <-- use-after-free

An incoming indication takes the default branch of
wcn36xx_smd_rsp_process() instead and passes the destroyed wcn->hal_ind_wq
to queue_work().

[1] https://sashiko.dev/#/bug/linux-198eb452-42f0-44e8-b29d-e7d05a4297df

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261118-wcnss-series-v1-v1-0-a64d82e151bf@atlr-engineering.com?part=3

  reply	other threads:[~2026-11-18 15:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 14:57 [PATCH 0/3] msm8974/wcn36xx: recover Wi-Fi after a WCNSS crash Alexandre Rapaille
2026-11-18 14:57 ` Alexandre Rapaille via B4 Relay
2026-11-18 14:57 ` [PATCH 1/3] ARM: dts: qcom: msm8974: Fix WCNSS wifi interrupt trigger type Alexandre Rapaille
2026-11-18 14:57   ` Alexandre Rapaille via B4 Relay
2026-11-18 16:14   ` Luca Weiss
2026-11-18 14:58 ` [PATCH 2/3] wifi: wcn36xx: Do not enforce " Alexandre Rapaille
2026-11-18 14:58   ` Alexandre Rapaille via B4 Relay
2026-11-18 16:13   ` Luca Weiss
2026-11-18 20:20   ` Loic Poulain
2026-11-19  6:59     ` Alexandre Rapaille
2026-11-19  9:05       ` Loic Poulain
2026-11-18 14:58 ` [PATCH 3/3] wifi: wcn36xx: Stop waiting on a dead firmware during remove Alexandre Rapaille
2026-11-18 14:58   ` Alexandre Rapaille via B4 Relay
2026-11-18 15:07   ` sashiko-bot [this message]
2026-11-18 20:29   ` Loic Poulain
2026-11-19  6:57     ` Alexandre Rapaille

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=sashiko-outbox-221294@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=arapaille@atlr-engineering.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.