From: Yunseong Kim <yunseong.kim@est.tech>
To: Jeff Johnson <jjohnson@kernel.org>,
Muhammad Usama Anjum <usama.anjum@arm.com>,
Baochen Qiang <baochen.qiang@oss.qualcomm.com>,
Maharaja Kennadyrajan <quic_mkenna@quicinc.com>,
Karthikeyan Periyasamy <quic_periyasa@quicinc.com>,
Vasanthakumar Thiagarajan
<vasanthakumar.thiagarajan@oss.qualcomm.com>,
Shashidhar Lakkavalli <slakkavalli@datto.com>,
Kalle Valo <kvalo@kernel.org>
Cc: Jeroen Trappers <jeroen.trappers@gmail.com>,
mike Seo <mikeseohyungjin@gmail.com>,
1152007@bugs.debian.org, stable@vger.kernel.org,
Jeff Johnson <jeff.johnson@oss.qualcomm.com>,
Sathishkumar Muruganandam <quic_murugana@quicinc.com>,
John Crispin <john@phrozen.org>,
Venkateswara Naralasetty <quic_vnaralas@quicinc.com>,
Sriram R <sriram.ramachandran@oss.qualcomm.com>,
linux-wireless@vger.kernel.org, ath11k@lists.infradead.org,
linux-kernel@vger.kernel.org,
Yunseong Kim <yunseong.kim@est.tech>
Subject: [PATCH 1/3] wifi: ath11k: don't free HAL SRNG memory when crash recovery fails
Date: Mon, 02 Nov 2026 12:59:51 +0100 [thread overview]
Message-ID: <20261102-ath11k-oom-v1-1-f3c391bd63f3@est.tech> (raw)
In-Reply-To: <20261102-ath11k-oom-v1-0-f3c391bd63f3@est.tech>
During system suspend/resume (such as s2idle), the device can go through
the crash recovery path (ath11k_core_restart() ->
ath11k_core_reconfigure_on_crash()). In this path, ath11k_dp_alloc()
requests a 1 MiB order-8 allocation for tx_status. Because the PM core
restricts allocations to GFP_NOIO during suspend/resume (via
pm_restrict_gfp_mask()), direct reclaim cannot perform I/O and direct
memory compaction is disabled. If memory is fragmented, reclaim fails to
form an order-8 contiguous block, and the 1 MiB allocation fails with
-ENOMEM.
When firmware crash recovery fails due to this allocation failure (or any
other failure during ath11k_core_qmi_firmware_ready()),
ath11k_core_reconfigure_on_crash() takes the error exit path and calls
ath11k_hal_srng_deinit().
This is fatal for two reasons:
1. HAL SRNG memory is allocated at driver probe and freed at driver
remove. Freeing it during crash recovery leaves CE and DP rings
(which were already set up again, e.g. by ath11k_ce_init_pipes())
with dangling pointers into unmapped DMA coherent memory (hal->rdp).
2. ATH11K_FLAG_CRASH_FLUSH was cleared before the reconfiguration
attempt and was not set again on failure. Consequently, when the PM
framework subsequently resumes subordinate devices (e.g. wiphy via
wiphy_resume() -> drv_start() -> ath11k_mac_op_start()),
ath11k_ce_send() does not bail out. It attempts to access the CE3
source ring and calls ath11k_hal_srng_access_begin(), which dereferences
srng->u.src_ring.tp_addr (pointing to the freed rdp buffer). Under an
IOMMU this triggers an unhandled page fault in interrupt context,
panicking the kernel.
Fix this by preserving the HAL SRNG memory across failed crash recovery
and setting ATH11K_FLAG_CRASH_FLUSH so that all subsequent CE, WMI, and
DP send operations immediately bail out with -ESHUTDOWN.
Reported-by: Jeroen Trappers <jeroen.trappers@gmail.com>
Closes: https://bugs.debian.org/1152007
Fixes: 32be3ca4cf78 ("wifi: ath11k: HAL SRNG: don't deinitialize and re-initialize again")
Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
Cc: Jeroen Trappers <jeroen.trappers@gmail.com>
Cc: 1152007@bugs.debian.org
Cc: stable@vger.kernel.org
Signed-off-by: Yunseong Kim <yunseong.kim@est.tech>
---
drivers/net/wireless/ath/ath11k/core.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c
index 766ae27306f43..b859b26f31114 100644
--- a/drivers/net/wireless/ath/ath11k/core.c
+++ b/drivers/net/wireless/ath/ath11k/core.c
@@ -2349,16 +2349,24 @@ static int ath11k_core_reconfigure_on_crash(struct ath11k_base *ab)
clear_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags);
ret = ath11k_core_qmi_firmware_ready(ab);
- if (ret)
- goto err_hal_srng_deinit;
+ if (ret) {
+ /* The firmware has been stopped and the data path is gone,
+ * but mac80211 may still call into the driver (e.g. drv_start
+ * from the wiphy resume). Treat the device as crashed so that
+ * WMI, CE and DP TX bail out until a later recovery succeeds.
+ *
+ * Do not free the HAL SRNG memory here: it is allocated at
+ * probe and freed at remove, and rings that were already set
+ * up again (e.g. by ath11k_ce_init_pipes()) still point into
+ * it.
+ */
+ set_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags);
+ return ret;
+ }
clear_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags);
return 0;
-
-err_hal_srng_deinit:
- ath11k_hal_srng_deinit(ab);
- return ret;
}
void ath11k_core_halt(struct ath11k *ar)
--
2.47.3
next prev parent reply other threads:[~2026-11-02 12:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 11:59 [PATCH 0/3] wifi: ath11k: fix crash recovery panic and order-8 allocation failure Yunseong Kim
2026-11-02 11:59 ` Yunseong Kim [this message]
2026-11-02 11:59 ` [PATCH 2/3] wifi: ath11k: use kvmalloc() for the TX completion status buffer Yunseong Kim
2026-11-02 11:59 ` [PATCH 3/3] wifi: ath11k: add KUnit tests for crash recovery and TX status allocation Yunseong Kim
2026-12-02 13:22 ` [PATCH 0/3] wifi: ath11k: fix crash recovery panic and order-8 allocation failure Yunseong Kim
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=20261102-ath11k-oom-v1-1-f3c391bd63f3@est.tech \
--to=yunseong.kim@est.tech \
--cc=1152007@bugs.debian.org \
--cc=ath11k@lists.infradead.org \
--cc=baochen.qiang@oss.qualcomm.com \
--cc=jeff.johnson@oss.qualcomm.com \
--cc=jeroen.trappers@gmail.com \
--cc=jjohnson@kernel.org \
--cc=john@phrozen.org \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=mikeseohyungjin@gmail.com \
--cc=quic_mkenna@quicinc.com \
--cc=quic_murugana@quicinc.com \
--cc=quic_periyasa@quicinc.com \
--cc=quic_vnaralas@quicinc.com \
--cc=slakkavalli@datto.com \
--cc=sriram.ramachandran@oss.qualcomm.com \
--cc=stable@vger.kernel.org \
--cc=usama.anjum@arm.com \
--cc=vasanthakumar.thiagarajan@oss.qualcomm.com \
/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
all inboxes | Powered by JetHome®