[PATCH ath-next 4/7] wifi: ath12k: skip links without channel context in ath12k_mac_get_vif_up()

From: Miaoqing Pan

Date: Tue Nov 17 2026 - 21:56:23 EST


Active-link deactivation releases the channel context of a link while its
vdev stays up in firmware. ath12k_mac_get_vif_up() returns the first vdev
that is up, and that vdev is used to derive the target pdev. It could pick
such a deactivated link, and ath12k_mac_get_target_pdev_id_from_vif() would
then find no channel for it.

Skip links without a channel context in ath12k_mac_get_vif_up(). The
WARN_ON() in ath12k_mac_get_target_pdev_id_from_vif() is kept, since
callers reaching it are expected to have a channel context.

Tested-on: QCC2072 hw1.0 PCI WLAN.COL.1.0.c2-00277-QCACOLSWPL_V1_TO_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3

Signed-off-by: Miaoqing Pan <miaoqing.pan@xxxxxxxxxxxxxxxx>
---
drivers/net/wireless/ath/ath12k/mac.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index 28cb549b1f46..08d9af0a1127 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -953,12 +953,23 @@ void ath12k_mac_get_any_chanctx_conf_iter(struct ieee80211_hw *hw,
static struct ath12k_link_vif *ath12k_mac_get_vif_up(struct ath12k *ar)
{
struct ath12k_link_vif *arvif;
+ struct cfg80211_chan_def def;

lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy);

list_for_each_entry(arvif, &ar->arvifs, list) {
- if (arvif->is_up)
- return arvif;
+ if (!arvif->is_up)
+ continue;
+
+ /*
+ * A deactivated MLO link keeps its vdev up in firmware but has
+ * released its channel context, so it cannot be used to pick
+ * the target pdev.
+ */
+ if (ath12k_mac_vif_link_chan(arvif->ahvif->vif, arvif->link_id, &def))
+ continue;
+
+ return arvif;
}

return NULL;
--
2.34.1