From: Rameshkumar Sundaram <rameshkumar.sundaram@oss.qualcomm.com>
To: Miaoqing Pan <miaoqing.pan@oss.qualcomm.com>, jjohnson@kernel.org
Cc: ath11k@lists.infradead.org, linux-wireless@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [RESEND PATCH ath-current 2/3] wifi: ath11k: fix NULL dereference in ahb remove when QMI init incomplete
Date: Wed, 5 Aug 2026 15:37:35 +0530 [thread overview]
Message-ID: <3214559e-a9a6-49ea-a421-c41698fc2114@oss.qualcomm.com> (raw)
In-Reply-To: <61e47242-7615-4bc7-af80-c671318b3c0d@oss.qualcomm.com>
On 8/3/2026 12:17 PM, Miaoqing Pan wrote:
>
>
> On 7/31/2026 5:24 PM, Rameshkumar Sundaram wrote:
>> On 7/30/2026 8:39 AM, Miaoqing Pan wrote:
>>> On WCN6750, if QMI messages never arrive (for example when qrtr_smd
>>> is not ready), WLAN initialization stops before the device is fully
>>> registered. In this case ATH11K_FLAG_QMI_FAIL is not set because no
>>> QMI event handler is executed.
>>>
>>> When the driver is removed, ath11k_ahb_remove() still calls
>>> ath11k_core_deinit(), which eventually triggers
>>> ath11k_ce_cleanup_pipes() on uninitialized CE pipes and results in a
>>> NULL pointer dereference in ath11k_hal_srng_access_begin():
>>>
>>> ath11k_hal_srng_access_begin+0x14/0x68 [ath11k]
>>> ath11k_ce_cleanup_pipes+0x184/0x190 [ath11k]
>>> ath11k_pcic_stop+0x24/0x38 [ath11k]
>>> ath11k_core_deinit+0xfc/0x1c0 [ath11k]
>>> ath11k_ahb_remove+0x38/0xa0 [ath11k_ahb]
>>>
>>> Fix this by invoking ath11k_ahb_remove_prepare() before the state
>>> check and skipping ath11k_core_deinit() when either QMI initialization
>>> failed or the device was never registered. If ATH11K_FLAG_REGISTERED
>>> is not set, core initialization did not complete and CE pipes may
>>> remain uninitialized, making ath11k_core_deinit() unsafe.
>>>
>>> Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.2.0.c2-00204-QCAMSLSWPLZ-1
>>>
>>> Fixes: 00402f49d26f ("ath11k: Add support for WCN6750 device")
>>> Signed-off-by: Miaoqing Pan <miaoqing.pan@oss.qualcomm.com>
>>> ---
>>> drivers/net/wireless/ath/ath11k/ahb.c | 6 ++++--
>>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/net/wireless/ath/ath11k/ahb.c b/drivers/net/
>>> wireless/ath/ath11k/ahb.c
>>> index fb5640882b98..7f5f5c8d7c56 100644
>>> --- a/drivers/net/wireless/ath/ath11k/ahb.c
>>> +++ b/drivers/net/wireless/ath/ath11k/ahb.c
>>> @@ -1265,14 +1265,16 @@ static void ath11k_ahb_remove(struct
>>> platform_device *pdev)
>>> {
>>> struct ath11k_base *ab = platform_get_drvdata(pdev);
>>> - if (test_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags)) {
>>> + ath11k_ahb_remove_prepare(ab);
>>> +
>>> + if (test_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags) ||
>>> + !test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags)) {
>>
>> Can we use ATH11K_FLAG_REGISTERED alone to decide the cleanup path? If
>> REGISTERED is set, ath11k_core_qmi_firmware_ready() completed at least
>> once and the normal ath11k_core_deinit() path should run. If QMI
>> failed on recovery (say before FW_READY or INIT_DONE) this should
>> still do core_deinit() isn't ?
>>
>>
> During SSR recovery, it is possible for a QMI failure to occur after the
> device has already been registered, which could result in both
> ATH11K_FLAG_REGISTERED and ATH11K_FLAG_QMI_FAIL being set at the same time.
Yeah so in that case current code will skip core_deinit() which should
actually run isn't ? Though the QMI has failed on recovery the core was
already initialized and should be torn down.
>>> ath11k_ahb_power_down(ab, false);
>>> ath11k_debugfs_soc_destroy(ab);
>>> ath11k_qmi_deinit_service(ab);
>>> goto qmi_fail;
>>> }
>>> - ath11k_ahb_remove_prepare(ab);
>>> ath11k_core_deinit(ab);
>>> qmi_fail:
>>
--
Ramesh
next prev parent reply other threads:[~2026-08-05 10:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 3:09 [RESEND PATCH ath-current 0/3] wifi: ath11k: fix QRTR readiness related WLAN initialization failures Miaoqing Pan
2026-07-30 3:09 ` [RESEND PATCH ath-current 1/3] wifi: ath11k: fix sporadic " Miaoqing Pan
2026-07-30 3:09 ` [RESEND PATCH ath-current 2/3] wifi: ath11k: fix NULL dereference in ahb remove when QMI init incomplete Miaoqing Pan
2026-07-31 9:24 ` Rameshkumar Sundaram
2026-08-03 6:47 ` Miaoqing Pan
2026-08-05 10:07 ` Rameshkumar Sundaram [this message]
2026-08-06 9:55 ` Miaoqing Pan
2026-07-30 3:09 ` [RESEND PATCH ath-current 3/3] wifi: ath11k: unregister PM notifier on QMI init failure path Miaoqing Pan
2026-07-31 23:06 ` Jeff Johnson
2026-08-03 7:07 ` Miaoqing Pan
2026-07-31 8:52 ` [RESEND PATCH ath-current 0/3] wifi: ath11k: fix QRTR readiness related WLAN initialization failures Baochen Qiang
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=3214559e-a9a6-49ea-a421-c41698fc2114@oss.qualcomm.com \
--to=rameshkumar.sundaram@oss.qualcomm.com \
--cc=ath11k@lists.infradead.org \
--cc=jjohnson@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=miaoqing.pan@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®