Devicetree
 help / color / mirror / Atom feed
From: Aaradhana Sahu <aaradhana.sahu@oss.qualcomm.com>
To: sashiko-reviews@lists.linux.dev
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH ath-next v2 08/17] wifi: ath12k: Add hif operation support for QCN6432
Date: Wed, 21 Oct 2026 15:39:30 +0530	[thread overview]
Message-ID: <99df2266-677a-4d38-ab6d-e89f22c472c1@oss.qualcomm.com> (raw)
In-Reply-To: <sashiko-outbox-173697@kernel.org>



On 10/16/2026 9:16 AM, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
> - [Critical] net: ath12k: unconfigured dynamic window in pcic read32/write32 causes out-of-bounds MMIO
> - [High] wifi: ath12k: use-after-free in timer callback ath12k_ce_rx_replenish_retry()
> --
> 
> commit d724e1834e7dbd2c47e113791169e389fe945179
> Author: Sowmiya Sree Elavalagan <quic_ssreeela@quicinc.com>
> wifi: ath12k: Add hif operation support for QCN6432
> 
> This commit adds HIF operations for the QCN6432 Wi-Fi driver by reusing
> existing methods from IPQ5332 and QCN9274 where applicable. It implements
> QCN6432-specific operations in a new pcic.c file.
> 
>> diff --git a/drivers/net/wireless/ath/ath12k/pcic.c b/drivers/net/wireless/ath/ath12k/pcic.c
>> new file mode 100644
>> index 0000000000000..e3c8476af459c
>> --- /dev/null
>> +++ b/drivers/net/wireless/ath/ath12k/pcic.c
> 
> [ ... ]
> 
>> +void ath12k_pcic_stop(struct ath12k_base *ab)
>> +{
>> +	ath12k_pci_ce_irq_disable_sync(ab);
>> +	timer_delete_sync(&ab->rx_replenish_retry);
>> +	ath12k_ce_cleanup_pipes(ab);
>> +}
> 
> [Severity: High]
> Is there a mechanism preventing ab->rx_replenish_retry from re-arming itself
> here?
> 
> If ath12k_pcic_stop() executes while the timer callback
> ath12k_ce_rx_replenish_retry() is running concurrently, timer_delete_sync()
> will wait. However, the callback invokes ath12k_ce_rx_post_buf(), which blindly
> re-arms the timer on allocation failures (-ENOMEM):
> 
> drivers/net/wireless/ath/ath12k/ce.c:ath12k_ce_rx_post_buf() {
>     ...
>     ret = ath12k_ce_rx_post_pipe(pipe);
>     if (ret) {
>         if (ret == -ENOSPC)
>             continue;
>         ...
>         mod_timer(&ab->rx_replenish_retry, ...);
>         return;
>     }
> }
> 
> Could this cause the timer to be re-enqueued after timer_delete_sync()
> unblocks, leading to a use-after-free regression when the timer fires after the
> structures are freed?
> 

The CE IRQs are disabled and synchronized before timer_delete_sync() is called.
This ensures that no new CE IRQ processing can trigger RX replenishment during
shutdown. timer_delete_sync() also waits for any currently running timer callback
to complete before the CE pipes are cleaned up.

> [ ... ]
> 
>> +u32 ath12k_pcic_read32(struct ath12k_base *ab, u32 offset)
>> +{
>> +	u32 window_start;
>> +
>> +	if (offset < WINDOW_START)
>> +		return readl_relaxed(ab->mem + offset);
>> +
>> +	window_start = ath12k_pcic_get_window_start(ab, offset);
>> +	return readl_relaxed(ab->mem + window_start + (offset & WINDOW_RANGE_MASK));
>> +}
> 
> [Severity: Critical]
> Does this read from an unconfigured dynamic window?
> 
> When offset does not fall into the statically mapped UMAC or CE ranges,
> ath12k_pcic_get_window_start() returns the fallback dynamic window address
> (WINDOW_START, which is Window 1).
> 
> However, unlike the cmem accessors or the PCI equivalent (ath12k_pci_read32)
> which explicitly lock and program Window 1 to the high bits of the target
> offset, this function skips configuration entirely and blindly performs the
> read.
> 
> Could this result in out-of-bounds MMIO reads, directing the read to whatever
> physical memory address the dynamic window was previously configured to map?
> 

This should not happen for QCN6432, as it uses the CMEM read/write operations for
accesses to windows that are not statically mapped. These accesses do not use this
function.

>> +
>> +void ath12k_pcic_write32(struct ath12k_base *ab, u32 offset, u32 value)
>> +{
>> +	u32 window_start;
>> +
>> +	if (offset < WINDOW_START) {
>> +		writel_relaxed(value, ab->mem + offset);
>> +		return;
>> +	}
>> +
>> +	window_start = ath12k_pcic_get_window_start(ab, offset);
>> +	writel_relaxed(value, ab->mem + window_start + (offset & WINDOW_RANGE_MASK));
>> +}
> 
> [Severity: Critical]
> Similarly, does this write to the dynamic window without first programming the
> hardware register to map the target offset?
> 
> Like the read path above, ath12k_pcic_write32() uses the dynamic window without
> calling a window selection function such as ath12k_pcic_select_static_window().
> 
> Will this regression corrupt memory or hardware state by writing to a previously
> configured but currently unrelated memory address?
> 

same explanation as above.


  reply	other threads:[~2026-10-21 10:09 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16  3:21 [PATCH ath-next v2 00/17] wifi: ath12k: Add support for QCN6432 Aaradhana Sahu
2026-10-16  3:21 ` [PATCH ath-next v2 01/17] dt-bindings: net: wireless: Add QCN6432 device tree binding documentation Aaradhana Sahu
2026-10-17 17:00   ` Krzysztof Kozlowski
2026-10-21  5:27     ` Aaradhana Sahu
2026-10-17 17:01   ` Krzysztof Kozlowski
2026-10-21  5:27     ` Aaradhana Sahu
2026-10-16  3:21 ` [PATCH ath-next v2 02/17] wifi: ath12k: Refactor PCI operations and MSI config structure Aaradhana Sahu
2026-10-16  3:21 ` [PATCH ath-next v2 03/17] wifi: ath12k: Add hardware parameter for QCN6432 Aaradhana Sahu
2026-10-16  3:41   ` sashiko-bot
2026-10-21  6:40     ` Aaradhana Sahu
2026-10-16  3:21 ` [PATCH ath-next v2 04/17] wifi: ath12k: Add hardware ring mask " Aaradhana Sahu
2026-10-16  3:21 ` [PATCH ath-next v2 05/17] wifi: ath12k: add hardware registers " Aaradhana Sahu
2026-10-16  3:21 ` [PATCH ath-next v2 06/17] wifi: ath12k: move multi MSI vector flag to ath12k_dev_flags Aaradhana Sahu
2026-10-16  3:21 ` [PATCH ath-next v2 07/17] wifi: ath12k: Add hybrid_bus_type in ath12k_hw_params Aaradhana Sahu
2026-10-16  3:21 ` [PATCH ath-next v2 08/17] wifi: ath12k: Add hif operation support for QCN6432 Aaradhana Sahu
2026-10-16  3:46   ` sashiko-bot
2026-10-21 10:09     ` Aaradhana Sahu [this message]
2026-10-16  3:21 ` [PATCH ath-next v2 09/17] wifi: ath12k: add support for unified data-region memory allocation Aaradhana Sahu
2026-10-16  3:35   ` sashiko-bot
2026-10-21 10:15     ` Aaradhana Sahu
2026-10-16  3:21 ` [PATCH ath-next v2 10/17] wifi: ath12k: move MSI config to pci.c Aaradhana Sahu
2026-10-16  3:21 ` [PATCH ath-next v2 11/17] wifi: ath12k: Add platform MSI support for CE Aaradhana Sahu
2026-10-16  3:21 ` [PATCH ath-next v2 12/17] wifi: ath12k: Enable MSI interrupt support for DP interrupt Aaradhana Sahu
2026-10-16  3:41   ` sashiko-bot
2026-10-21 10:44     ` Aaradhana Sahu
2026-10-16  3:21 ` [PATCH ath-next v2 13/17] wifi: ath12k: use CMEM write for PPT on hybrid bus devices Aaradhana Sahu
2026-10-16  3:41   ` sashiko-bot
2026-10-21 10:01     ` Aaradhana Sahu
2026-10-16  3:21 ` [PATCH ath-next v2 14/17] wifi: ath12k: store and use MSI data per CE and DP interrupt group for QCN6432 Aaradhana Sahu
2026-10-16  3:21 ` [PATCH ath-next v2 15/17] wifi: ath12k: Derive QMI service instance ID per protection domain Aaradhana Sahu
2026-10-16  3:21 ` [PATCH ath-next v2 16/17] wifi: ath12k: Resolve userPD ID per device Aaradhana Sahu
2026-10-16  3:21 ` [PATCH ath-next v2 17/17] wifi: ath12k: Add QCN6432 AHB support Aaradhana Sahu

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=99df2266-677a-4d38-ab6d-e89f22c472c1@oss.qualcomm.com \
    --to=aaradhana.sahu@oss.qualcomm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox