[PATCH net v7 4/6] net: wwan: t7xx: do not exit the TX push kthread on resume failure
From: Tim JH Chen
Date: Thu Nov 19 2026 - 20:56:48 EST
t7xx_dpmaif_tx_hw_push_thread() returns, ending the kthread, when the
runtime PM resume fails with anything other than -EACCES. kthread_run()
keeps no extra reference to the task, so the task_struct can be reaped
or reused while dpmaif_ctrl->tx_thread still points at it. A later
t7xx_dpmaif_tx_thread_rel() then calls kthread_stop() on the stale
pointer. It also stops TX permanently and silently.
This was hit in the field after a runtime suspend failure ("SAP
suspend error: -110") left dev->power.runtime_error set: every resume
returned -EINVAL, the thread exited, and a later write to the PCI
remove attribute crashed in kthread_stop() with a NULL
worker_private. The remove then hung in D state holding
pci_rescan_remove_lock and the machine could not shut down cleanly.
Log the failure and retry every second instead of exiting. Only the
first failure of a streak is logged. The wait ends early on
kthread_stop(), so the thread stays alive until
t7xx_dpmaif_tx_thread_rel() tears it down. Recovering from a sticky
runtime_error is a separate problem and is not attempted here.
Fixes: 46e8f49ed7b3 ("net: wwan: t7xx: Introduce power management")
Reported-by: Andreas Haerter <ah@xxxxxxxxxxxx>
Closes: https://lore.kernel.org/netdev/20261106054532.201311-1-ah@xxxxxxxxxxxx/
Signed-off-by: Tim JH Chen <tim770802@xxxxxxxxx>
---
drivers/net/wwan/t7xx/t7xx_hif_dpmaif_tx.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wwan/t7xx/t7xx_hif_dpmaif_tx.c b/drivers/net/wwan/t7xx/t7xx_hif_dpmaif_tx.c
index 48558b98e7c6..00e456bdd808 100644
--- a/drivers/net/wwan/t7xx/t7xx_hif_dpmaif_tx.c
+++ b/drivers/net/wwan/t7xx/t7xx_hif_dpmaif_tx.c
@@ -448,6 +448,7 @@ static void t7xx_do_tx_hw_push(struct dpmaif_ctrl *dpmaif_ctrl)
static int t7xx_dpmaif_tx_hw_push_thread(void *arg)
{
struct dpmaif_ctrl *dpmaif_ctrl = arg;
+ bool resume_failed = false;
bool txq_stopped;
int ret;
@@ -468,8 +469,19 @@ static int t7xx_dpmaif_tx_hw_push_thread(void *arg)
ret = pm_runtime_resume(dpmaif_ctrl->dev);
if (ret < 0 && ret != -EACCES) {
pm_runtime_put_noidle(dpmaif_ctrl->dev);
- return ret;
+ /* Do not exit: t7xx_dpmaif_tx_thread_rel() kthread_stop()s
+ * this task. Retry until the resume works or we are stopped.
+ */
+ if (!resume_failed)
+ dev_err(dpmaif_ctrl->dev,
+ "Failed to resume for TX push: %d\n", ret);
+ resume_failed = true;
+ wait_event_interruptible_timeout(dpmaif_ctrl->tx_wq,
+ kthread_should_stop(),
+ HZ);
+ continue;
}
+ resume_failed = false;
/* A runtime suspended device was resumed above and had its queues
* restarted, so a stopped queue here belongs to a system suspend
--
2.43.0