public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] wifi: mt76: fix potential deadlock caused by rx_lock
@ 2026-02-02  7:53 Shayne Chen
  2026-02-02  7:53 ` [PATCH 2/5] wifi: mt76: mt7996: fix wrong DMAD length when using MAC TXP Shayne Chen
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Shayne Chen @ 2026-02-02  7:53 UTC (permalink / raw)
  To: Felix Fietkau
  Cc: linux-wireless, Lorenzo Bianconi, Ryder Lee, Evelyn Tsai,
	Money Wang, linux-mediatek, Shayne Chen

A deadlock will occur if both of the following conditions are met,
because they each attempt to acquire the rx_lock:
- mac80211 receives an unexpected BAR control frame, which triggers
  a BA deletion
- A transmission failure happens due to an abnormality in DMA

Since ieee80211_tx_status_ext() is primarily used to address AQL issues,
avoid potential deadlocks by restricting calls to ieee80211_tx_status_ext
only for data frames.

Fixes: 94e4f5794627 ("mt76: dma: use ieee80211_tx_status_ext to free packets when tx fails")
Reviewed-by: Money Wang <money.wang@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
 drivers/net/wireless/mediatek/mt76/dma.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c
index 2d133ace7c33..928709f4a206 100644
--- a/drivers/net/wireless/mediatek/mt76/dma.c
+++ b/drivers/net/wireless/mediatek/mt76/dma.c
@@ -648,6 +648,8 @@ mt76_dma_tx_queue_skb(struct mt76_phy *phy, struct mt76_queue *q,
 		.skb = skb,
 	};
 	struct mt76_dev *dev = phy->dev;
+	struct ieee80211_tx_info *info;
+	struct ieee80211_hdr *hdr;
 	struct ieee80211_hw *hw;
 	int len, n = 0, ret = -ENOMEM;
 	struct mt76_txwi_cache *t;
@@ -736,9 +738,16 @@ mt76_dma_tx_queue_skb(struct mt76_phy *phy, struct mt76_queue *q,
 free_skb:
 	status.skb = tx_info.skb;
 	hw = mt76_tx_status_get_hw(dev, tx_info.skb);
-	spin_lock_bh(&dev->rx_lock);
-	ieee80211_tx_status_ext(hw, &status);
-	spin_unlock_bh(&dev->rx_lock);
+	hdr = (struct ieee80211_hdr *)tx_info.skb->data;
+	info = IEEE80211_SKB_CB(tx_info.skb);
+	if ((info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) ||
+	    ieee80211_is_data(hdr->frame_control)) {
+		spin_lock_bh(&dev->rx_lock);
+		ieee80211_tx_status_ext(hw, &status);
+		spin_unlock_bh(&dev->rx_lock);
+	} else {
+		ieee80211_free_txskb(hw, tx_info.skb);
+	}
 
 	return ret;
 }
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-02-02 12:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-02  7:53 [PATCH 1/5] wifi: mt76: fix potential deadlock caused by rx_lock Shayne Chen
2026-02-02  7:53 ` [PATCH 2/5] wifi: mt76: mt7996: fix wrong DMAD length when using MAC TXP Shayne Chen
2026-02-02  7:53 ` [PATCH 3/5] wifi: mt76: mt7996: fix struct mt7996_mcu_uni_event Shayne Chen
2026-02-02  7:53 ` [PATCH 4/5] wifi: mt76: avoid to set ACK for MCU command if wait_resp is not set Shayne Chen
2026-02-02  7:53 ` [PATCH 5/5] wifi: mt76: mt7996: fix queue pause after scan due to wrong channel switch reason Shayne Chen
2026-02-02  9:01   ` Felix Fietkau
2026-02-02 11:52     ` Shayne Chen
2026-02-02 12:22       ` Felix Fietkau
2026-02-02  8:52 ` [PATCH 1/5] wifi: mt76: fix potential deadlock caused by rx_lock Felix Fietkau
2026-02-02 11:46   ` Shayne Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox