Linux wireless drivers development
 help / color / mirror / Atom feed
From: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
To: Jiale Yao <yaojiale02@163.com>,
	Jeff Johnson <jjohnson@kernel.org>,
	Shashidhar Lakkavalli <slakkavalli@datto.com>,
	Venkateswara Naralasetty <quic_vnaralas@quicinc.com>,
	Maharaja Kennadyrajan <quic_mkenna@quicinc.com>,
	Ganesh Sesetti <gseset@codeaurora.org>,
	Miles Hu <milehu@codeaurora.org>,
	linux-wireless@vger.kernel.org, ath11k@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] wifi: ath11k: avoid IDR mutation during pending mgmt TX cleanup
Date: Tue, 29 Sep 2026 07:01:07 -0700	[thread overview]
Message-ID: <f3066128-7880-4396-b9c5-ef4c9821e3be@oss.qualcomm.com> (raw)
In-Reply-To: <20260926154824.75224-3-yaojiale02@163.com>

On 9/26/2026 8:48 AM, Jiale Yao wrote:
> ath11k_mac_tx_mgmt_pending_free() is passed as an idr_for_each()
> callback and removes the current entry from txmgmt_idr. This can
> invalidate the radix-tree iterator retained by idr_for_each().
> 
> Both callers destroy the IDR immediately after the walk, so removing
> each entry in the callback is unnecessary. Split skb release from IDR
> removal and let the callback release the supplied skb without updating
> the IDR. The following idr_destroy() tears down the IDR itself.
> 
> Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
> Signed-off-by: Jiale Yao <yaojiale02@163.com>
> ---
>  drivers/net/wireless/ath/ath11k/mac.c | 25 +++++++++++++++----------
>  1 file changed, 15 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
> index ae91b57c8422..696f9dd65ad4 100644
> --- a/drivers/net/wireless/ath/ath11k/mac.c
> +++ b/drivers/net/wireless/ath/ath11k/mac.c
> @@ -6146,18 +6146,11 @@ static void ath11k_mgmt_over_wmi_tx_drop(struct ath11k *ar, struct sk_buff *skb)
>  		wake_up(&ar->txmgmt_empty_waitq);
>  }
>  
> -static void ath11k_mac_tx_mgmt_free(struct ath11k *ar, int buf_id)
> +static void ath11k_mac_tx_mgmt_free_skb(struct ath11k *ar,
> +					struct sk_buff *msdu)
>  {
> -	struct sk_buff *msdu;
>  	struct ieee80211_tx_info *info;
>  
> -	spin_lock_bh(&ar->txmgmt_idr_lock);
> -	msdu = idr_remove(&ar->txmgmt_idr, buf_id);
> -	spin_unlock_bh(&ar->txmgmt_idr_lock);
> -
> -	if (!msdu)
> -		return;
> -
>  	dma_unmap_single(ar->ab->dev, ATH11K_SKB_CB(msdu)->paddr, msdu->len,
>  			 DMA_TO_DEVICE);
>  
> @@ -6167,11 +6160,23 @@ static void ath11k_mac_tx_mgmt_free(struct ath11k *ar, int buf_id)
>  	ath11k_mgmt_over_wmi_tx_drop(ar, msdu);
>  }
>  
> +static void ath11k_mac_tx_mgmt_free(struct ath11k *ar, int buf_id)
> +{
> +	struct sk_buff *msdu;
> +
> +	spin_lock_bh(&ar->txmgmt_idr_lock);
> +	msdu = idr_remove(&ar->txmgmt_idr, buf_id);
> +	spin_unlock_bh(&ar->txmgmt_idr_lock);
> +
> +	if (msdu)
> +		ath11k_mac_tx_mgmt_free_skb(ar, msdu);
> +}
> +
>  int ath11k_mac_tx_mgmt_pending_free(int buf_id, void *skb, void *ctx)
>  {
>  	struct ath11k *ar = ctx;
>  
> -	ath11k_mac_tx_mgmt_free(ar, buf_id);
> +	ath11k_mac_tx_mgmt_free_skb(ar, skb);
>  
>  	return 0;
>  }

Just documenting that this has the same potential UAF issue as the ath12k patch:

The ath11k patch makes the same structural change:
ath11k_mac_tx_mgmt_pending_free now calls
ath11k_mac_tx_mgmt_free_skb(ar, skb) instead of ath11k_mac_tx_mgmt_free(ar,
buf_id), so it frees the skb while leaving the IDR entry pointing to it until
idr_destroy() runs.

And we already confirmed that wmi_process_mgmt_tx_comp() in ath11k/wmi.c:6031
holds txmgmt_idr_lock, calls idr_find(), drops the lock, then dereferences the
returned pointer — the same UAF race as in ath12k.

/jeff

  reply	other threads:[~2026-09-29 14:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-26 15:48 [PATCH 0/5] wifi: ath: avoid IDR mutation while iterating Jiale Yao
2026-09-26 15:48 ` [PATCH 1/5] wifi: ath10k: avoid IDR mutation during TX cleanup Jiale Yao
2026-09-26 15:48 ` [PATCH 2/5] wifi: ath11k: avoid IDR mutation during pending mgmt " Jiale Yao
2026-09-29 14:01   ` Jeff Johnson [this message]
2026-09-26 15:48 ` [PATCH 3/5] wifi: ath11k: avoid IDR mutation during vif " Jiale Yao
2026-09-26 15:48 ` [PATCH 4/5] wifi: ath12k: avoid IDR mutation during pending " Jiale Yao
2026-09-28  5:49   ` Rameshkumar Sundaram
2026-09-28  8:26     ` jiale yao
2026-09-29 13:53       ` Jeff Johnson
2026-10-03  9:23       ` jiale yao
2026-09-26 15:48 ` [PATCH 5/5] wifi: ath12k: avoid IDR mutation during vif " Jiale Yao

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=f3066128-7880-4396-b9c5-ef4c9821e3be@oss.qualcomm.com \
    --to=jeff.johnson@oss.qualcomm.com \
    --cc=ath11k@lists.infradead.org \
    --cc=gseset@codeaurora.org \
    --cc=jjohnson@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=milehu@codeaurora.org \
    --cc=quic_mkenna@quicinc.com \
    --cc=quic_vnaralas@quicinc.com \
    --cc=slakkavalli@datto.com \
    --cc=yaojiale02@163.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