* [PATCH 0/3] msm8974/wcn36xx: recover Wi-Fi after a WCNSS crash
@ 2026-11-18 14:57 ` Alexandre Rapaille via B4 Relay
0 siblings, 0 replies; 16+ messages in thread
From: Alexandre Rapaille @ 2026-11-18 14:57 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Abel Vesa, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Loic Poulain, Luca Weiss,
Eugene Krasnikov
Cc: linux-arm-msm, devicetree, linux-kernel, wcn36xx, linux-wireless,
Alexandre Rapaille
On msm8974 the wcn36xx re-probe after a WCNSS crash fails on an IRQ type
mismatch (DT edge, driver level), so wlan0 stays gone until reboot; seen
on deployed Fairphone 2 gateways.
Tested on a Fairphone 2 (6.12.113 plus this series): 10/10 forced WCNSS
crashes recovered in ~20 s; unpatched, none did. Build-tested on
next-20261117, dtbs_check unchanged.
Patch 1 is for the qcom tree, 2-3 for ath. Patch 2 needs patch 1 on
msm8974, or its WCNSS IRQs would turn edge-triggered.
Signed-off-by: Alexandre Rapaille <arapaille@atlr-engineering.com>
---
Alexandre Rapaille (3):
ARM: dts: qcom: msm8974: Fix WCNSS wifi interrupt trigger type
wifi: wcn36xx: Do not enforce interrupt trigger type
wifi: wcn36xx: Stop waiting on a dead firmware during remove
arch/arm/boot/dts/qcom/qcom-msm8974.dtsi | 4 ++--
drivers/net/wireless/ath/wcn36xx/dxe.c | 6 +++---
drivers/net/wireless/ath/wcn36xx/main.c | 1 +
drivers/net/wireless/ath/wcn36xx/smd.c | 8 ++++++++
drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 4 ++++
5 files changed, 18 insertions(+), 5 deletions(-)
---
base-commit: 20eef29b7c8465ac98d7dd6d6f2ac07a8d8056ca
change-id: 20261118-wcnss-series-v1-ff46db05a31c
Best regards,
--
Alexandre Rapaille <arapaille@atlr-engineering.com>
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 0/3] msm8974/wcn36xx: recover Wi-Fi after a WCNSS crash
@ 2026-11-18 14:57 ` Alexandre Rapaille via B4 Relay
0 siblings, 0 replies; 16+ messages in thread
From: Alexandre Rapaille via B4 Relay @ 2026-11-18 14:57 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Abel Vesa, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Loic Poulain, Luca Weiss,
Eugene Krasnikov
Cc: linux-arm-msm, devicetree, linux-kernel, wcn36xx, linux-wireless,
Alexandre Rapaille
On msm8974 the wcn36xx re-probe after a WCNSS crash fails on an IRQ type
mismatch (DT edge, driver level), so wlan0 stays gone until reboot; seen
on deployed Fairphone 2 gateways.
Tested on a Fairphone 2 (6.12.113 plus this series): 10/10 forced WCNSS
crashes recovered in ~20 s; unpatched, none did. Build-tested on
next-20261117, dtbs_check unchanged.
Patch 1 is for the qcom tree, 2-3 for ath. Patch 2 needs patch 1 on
msm8974, or its WCNSS IRQs would turn edge-triggered.
Signed-off-by: Alexandre Rapaille <arapaille@atlr-engineering.com>
---
Alexandre Rapaille (3):
ARM: dts: qcom: msm8974: Fix WCNSS wifi interrupt trigger type
wifi: wcn36xx: Do not enforce interrupt trigger type
wifi: wcn36xx: Stop waiting on a dead firmware during remove
arch/arm/boot/dts/qcom/qcom-msm8974.dtsi | 4 ++--
drivers/net/wireless/ath/wcn36xx/dxe.c | 6 +++---
drivers/net/wireless/ath/wcn36xx/main.c | 1 +
drivers/net/wireless/ath/wcn36xx/smd.c | 8 ++++++++
drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 4 ++++
5 files changed, 18 insertions(+), 5 deletions(-)
---
base-commit: 20eef29b7c8465ac98d7dd6d6f2ac07a8d8056ca
change-id: 20261118-wcnss-series-v1-ff46db05a31c
Best regards,
--
Alexandre Rapaille <arapaille@atlr-engineering.com>
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 1/3] ARM: dts: qcom: msm8974: Fix WCNSS wifi interrupt trigger type
2026-11-18 14:57 ` Alexandre Rapaille via B4 Relay
@ 2026-11-18 14:57 ` Alexandre Rapaille via B4 Relay
-1 siblings, 0 replies; 16+ messages in thread
From: Alexandre Rapaille @ 2026-11-18 14:57 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Abel Vesa, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Loic Poulain, Luca Weiss,
Eugene Krasnikov
Cc: linux-arm-msm, devicetree, linux-kernel, wcn36xx, linux-wireless,
Alexandre Rapaille
wcn36xx requests tx/rx as IRQF_TRIGGER_HIGH, overriding this edge type, so
the re-probe after a WCNSS restart fails ("type mismatch, failed to map
hwirq-177") and wlan0 never returns. Use level high like other WCNSS SoCs.
Fixes: c7c0edecfba8 ("ARM: dts: msm8974: Introduce the wcnss remoteproc node")
Signed-off-by: Alexandre Rapaille <arapaille@atlr-engineering.com>
---
arch/arm/boot/dts/qcom/qcom-msm8974.dtsi | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/qcom/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom/qcom-msm8974.dtsi
index f300de74c4..b9666feb8b 100644
--- a/arch/arm/boot/dts/qcom/qcom-msm8974.dtsi
+++ b/arch/arm/boot/dts/qcom/qcom-msm8974.dtsi
@@ -814,8 +814,8 @@ bluetooth {
wifi {
compatible = "qcom,wcnss-wlan";
- interrupts = <GIC_SPI 145 IRQ_TYPE_EDGE_RISING>,
- <GIC_SPI 146 IRQ_TYPE_EDGE_RISING>;
+ interrupts = <GIC_SPI 145 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 146 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "tx", "rx";
qcom,smem-states = <&apps_smsm 10>, <&apps_smsm 9>;
--
2.43.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 1/3] ARM: dts: qcom: msm8974: Fix WCNSS wifi interrupt trigger type
@ 2026-11-18 14:57 ` Alexandre Rapaille via B4 Relay
0 siblings, 0 replies; 16+ messages in thread
From: Alexandre Rapaille via B4 Relay @ 2026-11-18 14:57 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Abel Vesa, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Loic Poulain, Luca Weiss,
Eugene Krasnikov
Cc: linux-arm-msm, devicetree, linux-kernel, wcn36xx, linux-wireless,
Alexandre Rapaille
From: Alexandre Rapaille <arapaille@atlr-engineering.com>
wcn36xx requests tx/rx as IRQF_TRIGGER_HIGH, overriding this edge type, so
the re-probe after a WCNSS restart fails ("type mismatch, failed to map
hwirq-177") and wlan0 never returns. Use level high like other WCNSS SoCs.
Fixes: c7c0edecfba8 ("ARM: dts: msm8974: Introduce the wcnss remoteproc node")
Signed-off-by: Alexandre Rapaille <arapaille@atlr-engineering.com>
---
arch/arm/boot/dts/qcom/qcom-msm8974.dtsi | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/qcom/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom/qcom-msm8974.dtsi
index f300de74c4..b9666feb8b 100644
--- a/arch/arm/boot/dts/qcom/qcom-msm8974.dtsi
+++ b/arch/arm/boot/dts/qcom/qcom-msm8974.dtsi
@@ -814,8 +814,8 @@ bluetooth {
wifi {
compatible = "qcom,wcnss-wlan";
- interrupts = <GIC_SPI 145 IRQ_TYPE_EDGE_RISING>,
- <GIC_SPI 146 IRQ_TYPE_EDGE_RISING>;
+ interrupts = <GIC_SPI 145 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 146 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "tx", "rx";
qcom,smem-states = <&apps_smsm 10>, <&apps_smsm 9>;
--
2.43.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 2/3] wifi: wcn36xx: Do not enforce interrupt trigger type
2026-11-18 14:57 ` Alexandre Rapaille via B4 Relay
@ 2026-11-18 14:58 ` Alexandre Rapaille via B4 Relay
-1 siblings, 0 replies; 16+ messages in thread
From: Alexandre Rapaille @ 2026-11-18 14:58 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Abel Vesa, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Loic Poulain, Luca Weiss,
Eugene Krasnikov
Cc: linux-arm-msm, devicetree, linux-kernel, wcn36xx, linux-wireless,
Alexandre Rapaille
Forcing IRQF_TRIGGER_HIGH over the DT type makes the re-probe after a WCNSS
restart fail ("type mismatch, failed to map hwirq"). Rely on the DT, as
commit 1ee6c5abebd3 ("ath10k: do not enforce interrupt trigger type") did.
Fixes: 8e84c2582169 ("wcn36xx: mac80211 driver for Qualcomm WCN3660/WCN3680 hardware")
Signed-off-by: Alexandre Rapaille <arapaille@atlr-engineering.com>
---
drivers/net/wireless/ath/wcn36xx/dxe.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/ath/wcn36xx/dxe.c b/drivers/net/wireless/ath/wcn36xx/dxe.c
index 801f1218ef..7852f71368 100644
--- a/drivers/net/wireless/ath/wcn36xx/dxe.c
+++ b/drivers/net/wireless/ath/wcn36xx/dxe.c
@@ -552,14 +552,14 @@ static int wcn36xx_dxe_request_irqs(struct wcn36xx *wcn)
{
int ret;
- ret = request_irq(wcn->tx_irq, wcn36xx_irq_tx_complete,
- IRQF_TRIGGER_HIGH, "wcn36xx_tx", wcn);
+ ret = request_irq(wcn->tx_irq, wcn36xx_irq_tx_complete, 0,
+ "wcn36xx_tx", wcn);
if (ret) {
wcn36xx_err("failed to alloc tx irq\n");
goto out_err;
}
- ret = request_irq(wcn->rx_irq, wcn36xx_irq_rx_ready, IRQF_TRIGGER_HIGH,
+ ret = request_irq(wcn->rx_irq, wcn36xx_irq_rx_ready, 0,
"wcn36xx_rx", wcn);
if (ret) {
wcn36xx_err("failed to alloc rx irq\n");
--
2.43.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 2/3] wifi: wcn36xx: Do not enforce interrupt trigger type
@ 2026-11-18 14:58 ` Alexandre Rapaille via B4 Relay
0 siblings, 0 replies; 16+ messages in thread
From: Alexandre Rapaille via B4 Relay @ 2026-11-18 14:58 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Abel Vesa, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Loic Poulain, Luca Weiss,
Eugene Krasnikov
Cc: linux-arm-msm, devicetree, linux-kernel, wcn36xx, linux-wireless,
Alexandre Rapaille
From: Alexandre Rapaille <arapaille@atlr-engineering.com>
Forcing IRQF_TRIGGER_HIGH over the DT type makes the re-probe after a WCNSS
restart fail ("type mismatch, failed to map hwirq"). Rely on the DT, as
commit 1ee6c5abebd3 ("ath10k: do not enforce interrupt trigger type") did.
Fixes: 8e84c2582169 ("wcn36xx: mac80211 driver for Qualcomm WCN3660/WCN3680 hardware")
Signed-off-by: Alexandre Rapaille <arapaille@atlr-engineering.com>
---
drivers/net/wireless/ath/wcn36xx/dxe.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/ath/wcn36xx/dxe.c b/drivers/net/wireless/ath/wcn36xx/dxe.c
index 801f1218ef..7852f71368 100644
--- a/drivers/net/wireless/ath/wcn36xx/dxe.c
+++ b/drivers/net/wireless/ath/wcn36xx/dxe.c
@@ -552,14 +552,14 @@ static int wcn36xx_dxe_request_irqs(struct wcn36xx *wcn)
{
int ret;
- ret = request_irq(wcn->tx_irq, wcn36xx_irq_tx_complete,
- IRQF_TRIGGER_HIGH, "wcn36xx_tx", wcn);
+ ret = request_irq(wcn->tx_irq, wcn36xx_irq_tx_complete, 0,
+ "wcn36xx_tx", wcn);
if (ret) {
wcn36xx_err("failed to alloc tx irq\n");
goto out_err;
}
- ret = request_irq(wcn->rx_irq, wcn36xx_irq_rx_ready, IRQF_TRIGGER_HIGH,
+ ret = request_irq(wcn->rx_irq, wcn36xx_irq_rx_ready, 0,
"wcn36xx_rx", wcn);
if (ret) {
wcn36xx_err("failed to alloc rx irq\n");
--
2.43.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 3/3] wifi: wcn36xx: Stop waiting on a dead firmware during remove
2026-11-18 14:57 ` Alexandre Rapaille via B4 Relay
@ 2026-11-18 14:58 ` Alexandre Rapaille via B4 Relay
-1 siblings, 0 replies; 16+ messages in thread
From: Alexandre Rapaille @ 2026-11-18 14:58 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Abel Vesa, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Loic Poulain, Luca Weiss,
Eugene Krasnikov
Cc: linux-arm-msm, devicetree, linux-kernel, wcn36xx, linux-wireless,
Alexandre Rapaille
After a WCNSS crash, remove sends ~16 HAL commands nobody can answer,
each waiting HAL_MSG_TIMEOUT: recovery took 160 s on msm8974. Once one
times out during remove, fail the rest at once; recovery now takes ~20 s.
Signed-off-by: Alexandre Rapaille <arapaille@atlr-engineering.com>
---
drivers/net/wireless/ath/wcn36xx/main.c | 1 +
drivers/net/wireless/ath/wcn36xx/smd.c | 8 ++++++++
drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 4 ++++
3 files changed, 13 insertions(+)
diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
index ad8a4bd910..77a1029108 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);
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c
index c0b4773458..d07ea967ac 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -427,6 +427,12 @@ static int wcn36xx_smd_send_and_wait(struct wcn36xx *wcn, size_t len)
(struct wcn36xx_hal_msg_header *)wcn->hal_buf;
u16 req_type = hdr->msg_type;
+ /* After a WCNSS crash every teardown command would wait the full
+ * timeout; one is enough to know nobody will answer.
+ */
+ if (wcn->fw_dead)
+ return -ETIME;
+
wcn36xx_dbg_dump(WCN36XX_DBG_SMD_DUMP, "HAL >>> ", wcn->hal_buf, len);
init_completion(&wcn->hal_rsp_compl);
@@ -440,6 +446,8 @@ static int wcn36xx_smd_send_and_wait(struct wcn36xx *wcn, size_t len)
msecs_to_jiffies(HAL_MSG_TIMEOUT)) <= 0) {
wcn36xx_err("Timeout! No SMD response to req %d in %dms\n",
req_type, HAL_MSG_TIMEOUT);
+ if (READ_ONCE(wcn->removing))
+ wcn->fw_dead = true;
ret = -ETIME;
goto out;
}
diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
index 8c43f67bd7..9e5f3918ca 100644
--- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
+++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
@@ -276,6 +276,10 @@ struct wcn36xx {
spinlock_t dxe_lock;
bool queues_stopped;
+ /* Set in remove; a HAL timeout then means the firmware is gone. */
+ bool removing;
+ bool fw_dead;
+
/* Memory pools */
struct wcn36xx_dxe_mem_pool mgmt_mem_pool;
struct wcn36xx_dxe_mem_pool data_mem_pool;
--
2.43.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 3/3] wifi: wcn36xx: Stop waiting on a dead firmware during remove
@ 2026-11-18 14:58 ` Alexandre Rapaille via B4 Relay
0 siblings, 0 replies; 16+ messages in thread
From: Alexandre Rapaille via B4 Relay @ 2026-11-18 14:58 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Abel Vesa, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Loic Poulain, Luca Weiss,
Eugene Krasnikov
Cc: linux-arm-msm, devicetree, linux-kernel, wcn36xx, linux-wireless,
Alexandre Rapaille
From: Alexandre Rapaille <arapaille@atlr-engineering.com>
After a WCNSS crash, remove sends ~16 HAL commands nobody can answer,
each waiting HAL_MSG_TIMEOUT: recovery took 160 s on msm8974. Once one
times out during remove, fail the rest at once; recovery now takes ~20 s.
Signed-off-by: Alexandre Rapaille <arapaille@atlr-engineering.com>
---
drivers/net/wireless/ath/wcn36xx/main.c | 1 +
drivers/net/wireless/ath/wcn36xx/smd.c | 8 ++++++++
drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 4 ++++
3 files changed, 13 insertions(+)
diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
index ad8a4bd910..77a1029108 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);
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c
index c0b4773458..d07ea967ac 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -427,6 +427,12 @@ static int wcn36xx_smd_send_and_wait(struct wcn36xx *wcn, size_t len)
(struct wcn36xx_hal_msg_header *)wcn->hal_buf;
u16 req_type = hdr->msg_type;
+ /* After a WCNSS crash every teardown command would wait the full
+ * timeout; one is enough to know nobody will answer.
+ */
+ if (wcn->fw_dead)
+ return -ETIME;
+
wcn36xx_dbg_dump(WCN36XX_DBG_SMD_DUMP, "HAL >>> ", wcn->hal_buf, len);
init_completion(&wcn->hal_rsp_compl);
@@ -440,6 +446,8 @@ static int wcn36xx_smd_send_and_wait(struct wcn36xx *wcn, size_t len)
msecs_to_jiffies(HAL_MSG_TIMEOUT)) <= 0) {
wcn36xx_err("Timeout! No SMD response to req %d in %dms\n",
req_type, HAL_MSG_TIMEOUT);
+ if (READ_ONCE(wcn->removing))
+ wcn->fw_dead = true;
ret = -ETIME;
goto out;
}
diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
index 8c43f67bd7..9e5f3918ca 100644
--- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
+++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
@@ -276,6 +276,10 @@ struct wcn36xx {
spinlock_t dxe_lock;
bool queues_stopped;
+ /* Set in remove; a HAL timeout then means the firmware is gone. */
+ bool removing;
+ bool fw_dead;
+
/* Memory pools */
struct wcn36xx_dxe_mem_pool mgmt_mem_pool;
struct wcn36xx_dxe_mem_pool data_mem_pool;
--
2.43.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH 3/3] wifi: wcn36xx: Stop waiting on a dead firmware during remove
2026-11-18 14:58 ` Alexandre Rapaille via B4 Relay
(?)
@ 2026-11-18 15:07 ` sashiko-bot
-1 siblings, 0 replies; 16+ messages in thread
From: sashiko-bot @ 2026-11-18 15:07 UTC (permalink / raw)
To: Alexandre Rapaille; +Cc: devicetree, robh, conor+dt
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 2/3] wifi: wcn36xx: Do not enforce interrupt trigger type
2026-11-18 14:58 ` Alexandre Rapaille via B4 Relay
(?)
@ 2026-11-18 16:13 ` Luca Weiss
-1 siblings, 0 replies; 16+ messages in thread
From: Luca Weiss @ 2026-11-18 16:13 UTC (permalink / raw)
To: arapaille, Bjorn Andersson, Konrad Dybcio, Abel Vesa, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Loic Poulain, Luca Weiss,
Eugene Krasnikov
Cc: linux-arm-msm, devicetree, linux-kernel, wcn36xx, linux-wireless
On Wed Nov 18, 2026 at 3:58 PM CET, Alexandre Rapaille via B4 Relay wrote:
> From: Alexandre Rapaille <arapaille@atlr-engineering.com>
>
> Forcing IRQF_TRIGGER_HIGH over the DT type makes the re-probe after a WCNSS
> restart fail ("type mismatch, failed to map hwirq"). Rely on the DT, as
> commit 1ee6c5abebd3 ("ath10k: do not enforce interrupt trigger type") did.
Worth noting, that all upstream dts files that use qcom,wcnss-wlan
(apart from msm8974.dtsi which is getting updated in this series) are
already using IRQ_TYPE_LEVEL_HIGH, so this should not change behavior
for any other SoC.
>
> Fixes: 8e84c2582169 ("wcn36xx: mac80211 driver for Qualcomm WCN3660/WCN3680 hardware")
> Signed-off-by: Alexandre Rapaille <arapaille@atlr-engineering.com>
> ---
> drivers/net/wireless/ath/wcn36xx/dxe.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/wcn36xx/dxe.c b/drivers/net/wireless/ath/wcn36xx/dxe.c
> index 801f1218ef..7852f71368 100644
> --- a/drivers/net/wireless/ath/wcn36xx/dxe.c
> +++ b/drivers/net/wireless/ath/wcn36xx/dxe.c
> @@ -552,14 +552,14 @@ static int wcn36xx_dxe_request_irqs(struct wcn36xx *wcn)
> {
> int ret;
>
> - ret = request_irq(wcn->tx_irq, wcn36xx_irq_tx_complete,
> - IRQF_TRIGGER_HIGH, "wcn36xx_tx", wcn);
> + ret = request_irq(wcn->tx_irq, wcn36xx_irq_tx_complete, 0,
> + "wcn36xx_tx", wcn);
> if (ret) {
> wcn36xx_err("failed to alloc tx irq\n");
> goto out_err;
> }
>
> - ret = request_irq(wcn->rx_irq, wcn36xx_irq_rx_ready, IRQF_TRIGGER_HIGH,
> + ret = request_irq(wcn->rx_irq, wcn36xx_irq_rx_ready, 0,
> "wcn36xx_rx", wcn);
> if (ret) {
> wcn36xx_err("failed to alloc rx irq\n");
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/3] ARM: dts: qcom: msm8974: Fix WCNSS wifi interrupt trigger type
2026-11-18 14:57 ` Alexandre Rapaille via B4 Relay
(?)
@ 2026-11-18 16:14 ` Luca Weiss
-1 siblings, 0 replies; 16+ messages in thread
From: Luca Weiss @ 2026-11-18 16:14 UTC (permalink / raw)
To: arapaille, Bjorn Andersson, Konrad Dybcio, Abel Vesa, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Loic Poulain, Luca Weiss,
Eugene Krasnikov
Cc: linux-arm-msm, devicetree, linux-kernel, wcn36xx, linux-wireless
On Wed Nov 18, 2026 at 3:57 PM CET, Alexandre Rapaille via B4 Relay wrote:
> From: Alexandre Rapaille <arapaille@atlr-engineering.com>
>
> wcn36xx requests tx/rx as IRQF_TRIGGER_HIGH, overriding this edge type, so
> the re-probe after a WCNSS restart fails ("type mismatch, failed to map
> hwirq-177") and wlan0 never returns. Use level high like other WCNSS SoCs.
Looks sane, I've had plenty issues like this before with other SoCs.
Reviewed-by: Luca Weiss <luca.weiss@fairphone.com>
>
> Fixes: c7c0edecfba8 ("ARM: dts: msm8974: Introduce the wcnss remoteproc node")
> Signed-off-by: Alexandre Rapaille <arapaille@atlr-engineering.com>
> ---
> arch/arm/boot/dts/qcom/qcom-msm8974.dtsi | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/boot/dts/qcom/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom/qcom-msm8974.dtsi
> index f300de74c4..b9666feb8b 100644
> --- a/arch/arm/boot/dts/qcom/qcom-msm8974.dtsi
> +++ b/arch/arm/boot/dts/qcom/qcom-msm8974.dtsi
> @@ -814,8 +814,8 @@ bluetooth {
> wifi {
> compatible = "qcom,wcnss-wlan";
>
> - interrupts = <GIC_SPI 145 IRQ_TYPE_EDGE_RISING>,
> - <GIC_SPI 146 IRQ_TYPE_EDGE_RISING>;
> + interrupts = <GIC_SPI 145 IRQ_TYPE_LEVEL_HIGH>,
> + <GIC_SPI 146 IRQ_TYPE_LEVEL_HIGH>;
> interrupt-names = "tx", "rx";
>
> qcom,smem-states = <&apps_smsm 10>, <&apps_smsm 9>;
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 2/3] wifi: wcn36xx: Do not enforce interrupt trigger type
2026-11-18 14:58 ` Alexandre Rapaille via B4 Relay
(?)
(?)
@ 2026-11-18 20:20 ` Loic Poulain
2026-11-19 6:59 ` Alexandre Rapaille
-1 siblings, 1 reply; 16+ messages in thread
From: Loic Poulain @ 2026-11-18 20:20 UTC (permalink / raw)
To: arapaille
Cc: Bjorn Andersson, Konrad Dybcio, Abel Vesa, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Luca Weiss, Eugene Krasnikov,
linux-arm-msm, devicetree, linux-kernel, wcn36xx, linux-wireless
On Wed, Nov 18, 2026 at 3:58 PM Alexandre Rapaille via B4 Relay
<devnull+arapaille.atlr-engineering.com@kernel.org> wrote:
>
> From: Alexandre Rapaille <arapaille@atlr-engineering.com>
>
> Forcing IRQF_TRIGGER_HIGH over the DT type makes the re-probe after a WCNSS
> restart fail ("type mismatch, failed to map hwirq"). Rely on the DT, as
> commit 1ee6c5abebd3 ("ath10k: do not enforce interrupt trigger type") did.
Can you explain why it fails? Is the fix at the right layer here?
>
> Fixes: 8e84c2582169 ("wcn36xx: mac80211 driver for Qualcomm WCN3660/WCN3680 hardware")
> Signed-off-by: Alexandre Rapaille <arapaille@atlr-engineering.com>
> ---
> drivers/net/wireless/ath/wcn36xx/dxe.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/wcn36xx/dxe.c b/drivers/net/wireless/ath/wcn36xx/dxe.c
> index 801f1218ef..7852f71368 100644
> --- a/drivers/net/wireless/ath/wcn36xx/dxe.c
> +++ b/drivers/net/wireless/ath/wcn36xx/dxe.c
> @@ -552,14 +552,14 @@ static int wcn36xx_dxe_request_irqs(struct wcn36xx *wcn)
> {
> int ret;
>
> - ret = request_irq(wcn->tx_irq, wcn36xx_irq_tx_complete,
> - IRQF_TRIGGER_HIGH, "wcn36xx_tx", wcn);
> + ret = request_irq(wcn->tx_irq, wcn36xx_irq_tx_complete, 0,
> + "wcn36xx_tx", wcn);
> if (ret) {
> wcn36xx_err("failed to alloc tx irq\n");
> goto out_err;
> }
>
> - ret = request_irq(wcn->rx_irq, wcn36xx_irq_rx_ready, IRQF_TRIGGER_HIGH,
> + ret = request_irq(wcn->rx_irq, wcn36xx_irq_rx_ready, 0,
> "wcn36xx_rx", wcn);
> if (ret) {
> wcn36xx_err("failed to alloc rx irq\n");
>
> --
> 2.43.0
>
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 3/3] wifi: wcn36xx: Stop waiting on a dead firmware during remove
2026-11-18 14:58 ` Alexandre Rapaille via B4 Relay
(?)
(?)
@ 2026-11-18 20:29 ` Loic Poulain
2026-11-19 6:57 ` Alexandre Rapaille
-1 siblings, 1 reply; 16+ messages in thread
From: Loic Poulain @ 2026-11-18 20:29 UTC (permalink / raw)
To: arapaille
Cc: Bjorn Andersson, Konrad Dybcio, Abel Vesa, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Luca Weiss, Eugene Krasnikov,
linux-arm-msm, devicetree, linux-kernel, wcn36xx, linux-wireless
On Wed, Nov 18, 2026 at 3:58 PM Alexandre Rapaille via B4 Relay
<devnull+arapaille.atlr-engineering.com@kernel.org> wrote:
>
> From: Alexandre Rapaille <arapaille@atlr-engineering.com>
>
> After a WCNSS crash, remove sends ~16 HAL commands nobody can answer,
> each waiting HAL_MSG_TIMEOUT: recovery took 160 s on msm8974. Once one
> times out during remove, fail the rest at once; recovery now takes ~20 s.
>
> Signed-off-by: Alexandre Rapaille <arapaille@atlr-engineering.com>
> ---
> drivers/net/wireless/ath/wcn36xx/main.c | 1 +
> drivers/net/wireless/ath/wcn36xx/smd.c | 8 ++++++++
> drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 4 ++++
> 3 files changed, 13 insertions(+)
>
> diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
> index ad8a4bd910..77a1029108 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);
> diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c
> index c0b4773458..d07ea967ac 100644
> --- a/drivers/net/wireless/ath/wcn36xx/smd.c
> +++ b/drivers/net/wireless/ath/wcn36xx/smd.c
> @@ -427,6 +427,12 @@ static int wcn36xx_smd_send_and_wait(struct wcn36xx *wcn, size_t len)
> (struct wcn36xx_hal_msg_header *)wcn->hal_buf;
> u16 req_type = hdr->msg_type;
>
> + /* After a WCNSS crash every teardown command would wait the full
> + * timeout; one is enough to know nobody will answer.
> + */
> + if (wcn->fw_dead)
It's not clear from the commit message why you need two variables
here, why not simply testing wcn->removing.
> + return -ETIME;
> +
> wcn36xx_dbg_dump(WCN36XX_DBG_SMD_DUMP, "HAL >>> ", wcn->hal_buf, len);
>
> init_completion(&wcn->hal_rsp_compl);
> @@ -440,6 +446,8 @@ static int wcn36xx_smd_send_and_wait(struct wcn36xx *wcn, size_t len)
> msecs_to_jiffies(HAL_MSG_TIMEOUT)) <= 0) {
> wcn36xx_err("Timeout! No SMD response to req %d in %dms\n",
> req_type, HAL_MSG_TIMEOUT);
> + if (READ_ONCE(wcn->removing))
> + wcn->fw_dead = true;
> ret = -ETIME;
> goto out;
> }
> diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
> index 8c43f67bd7..9e5f3918ca 100644
> --- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
> +++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
> @@ -276,6 +276,10 @@ struct wcn36xx {
> spinlock_t dxe_lock;
> bool queues_stopped;
>
> + /* Set in remove; a HAL timeout then means the firmware is gone. */
> + bool removing;
> + bool fw_dead;
> +
> /* Memory pools */
> struct wcn36xx_dxe_mem_pool mgmt_mem_pool;
> struct wcn36xx_dxe_mem_pool data_mem_pool;
>
> --
> 2.43.0
>
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* RE: [PATCH 3/3] wifi: wcn36xx: Stop waiting on a dead firmware during remove
2026-11-18 20:29 ` Loic Poulain
@ 2026-11-19 6:57 ` Alexandre Rapaille
0 siblings, 0 replies; 16+ messages in thread
From: Alexandre Rapaille @ 2026-11-19 6:57 UTC (permalink / raw)
To: Loic Poulain
Cc: Bjorn Andersson, Konrad Dybcio, Abel Vesa, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Luca Weiss, Eugene Krasnikov,
linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, wcn36xx@lists.infradead.org,
linux-wireless@vger.kernel.org
> It's not clear from the commit message why you need two variables
> here, why not simply testing wcn->removing.
Testing removing alone would also skip the teardown commands on a
normal unbind with live firmware. fw_dead is only set once a command
has actually timed out during remove, so a healthy firmware still gets
the full teardown. I'll say so in the commit message in v2.
^ permalink raw reply [flat|nested] 16+ messages in thread
* RE: [PATCH 2/3] wifi: wcn36xx: Do not enforce interrupt trigger type
2026-11-18 20:20 ` Loic Poulain
@ 2026-11-19 6:59 ` Alexandre Rapaille
2026-11-19 9:05 ` Loic Poulain
0 siblings, 1 reply; 16+ messages in thread
From: Alexandre Rapaille @ 2026-11-19 6:59 UTC (permalink / raw)
To: Loic Poulain
Cc: Bjorn Andersson, Konrad Dybcio, Abel Vesa, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Luca Weiss, Eugene Krasnikov,
linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, wcn36xx@lists.infradead.org,
linux-wireless@vger.kernel.org
> Can you explain why it fails? Is the fix at the right layer here?
On the first probe, request_irq() with IRQF_TRIGGER_HIGH overrides the
DT's edge type and stores level on the mapping, which outlives the
driver. On the re-probe after a WCNSS restart,
irq_create_fwspec_mapping() finds that mapping with a type different
from the DT's and refuses it ("type mismatch"), so
platform_get_irq_byname() returns -ENXIO.
The fix for that is patch 1: with the DT saying level, both agree and
recovery works without this patch (30/30 forced crashes). This one only
stops the driver overriding the DT, as ath10k does; as Luca noted,
every other qcom,wcnss-wlan DT already uses level high. Happy to drop
it if you'd rather keep the flag.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 2/3] wifi: wcn36xx: Do not enforce interrupt trigger type
2026-11-19 6:59 ` Alexandre Rapaille
@ 2026-11-19 9:05 ` Loic Poulain
0 siblings, 0 replies; 16+ messages in thread
From: Loic Poulain @ 2026-11-19 9:05 UTC (permalink / raw)
To: Alexandre Rapaille
Cc: Bjorn Andersson, Konrad Dybcio, Abel Vesa, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Luca Weiss, Eugene Krasnikov,
linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, wcn36xx@lists.infradead.org,
linux-wireless@vger.kernel.org
On Thu, Nov 19, 2026 at 7:59 AM Alexandre Rapaille
<arapaille@atlr-engineering.com> wrote:
>
> > Can you explain why it fails? Is the fix at the right layer here?
>
> On the first probe, request_irq() with IRQF_TRIGGER_HIGH overrides the
> DT's edge type and stores level on the mapping, which outlives the
> driver. On the re-probe after a WCNSS restart,
> irq_create_fwspec_mapping() finds that mapping with a type different
> from the DT's and refuses it ("type mismatch"), so
> platform_get_irq_byname() returns -ENXIO.
>
> The fix for that is patch 1: with the DT saying level, both agree and
> recovery works without this patch (30/30 forced crashes). This one only
> stops the driver overriding the DT, as ath10k does; as Luca noted,
> every other qcom,wcnss-wlan DT already uses level high. Happy to drop
> it if you'd rather keep the flag.
OK, then it would be good to include that information in the commit
message. I'm also wondering whether the actual stable fix should be
limited to patch 1. This patch could potentially break out-of-tree
platforms with an incorrect DTS IRQ trigger configuration that only
works today because of this override.
Regards,
Loic
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2026-11-19 9:05 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2026-11-18 20:29 ` Loic Poulain
2026-11-19 6:57 ` Alexandre Rapaille
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.