Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Aaradhana Sahu" <aaradhana.sahu@oss.qualcomm.com>
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: Fri, 16 Oct 2026 03:46:28 +0000	[thread overview]
Message-ID: <sashiko-outbox-173697@kernel.org> (raw)
In-Reply-To: <20261016-mpp-bringup-v2-8-f510c33bfcf5@oss.qualcomm.com>

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?

[ ... ]

> +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?

> +
> +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?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261016-mpp-bringup-v2-0-f510c33bfcf5@oss.qualcomm.com?part=8

  reply	other threads:[~2026-10-16  3:46 UTC|newest]

Thread overview: 23+ 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-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-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 [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-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-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-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=sashiko-outbox-173697@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=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