Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH v2] wifi: mt76: fix possible NULL access in mt76_tx
@ 2026-12-03  7:48 Eason Lai
  0 siblings, 0 replies; only message in thread
From: Eason Lai @ 2026-12-03  7:48 UTC (permalink / raw)
  To: nbd, lorenzo
  Cc: linux-wireless, linux-mediatek, kun.wu, deren.wu, sean.wang,
	quan.zhou, ryder.lee, leon.yen, litien.chang, jb.tsai, eason.lai,
	Anthony Liu

Add WARN_ON_ONCE(!wcid) early return and drop redundant wcid NULL check

Co-developed-by: Anthony Liu <anthony.liu@mediatek.com>
Signed-off-by: Anthony Liu <anthony.liu@mediatek.com>
Signed-off-by: Eason Lai <eason.lai@mediatek.com>
---
v2: replace WARN_ON() by WARN_ON_ONCE()
---
 drivers/net/wireless/mediatek/mt76/tx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/tx.c b/drivers/net/wireless/mediatek/mt76/tx.c
index 1621fc3e2cfb..4dde5cbd1cf6 100644
--- a/drivers/net/wireless/mediatek/mt76/tx.c
+++ b/drivers/net/wireless/mediatek/mt76/tx.c
@@ -377,7 +377,7 @@ mt76_tx(struct mt76_phy *phy, struct ieee80211_sta *sta,
 	struct mt76_dev *dev = phy->dev;
 	struct sk_buff_head *head;
 
-	if (mt76_testmode_enabled(phy)) {
+	if (WARN_ON_ONCE(!wcid) || mt76_testmode_enabled(phy)) {
 		ieee80211_free_txskb(phy->hw, skb);
 		return;
 	}
@@ -385,7 +385,7 @@ mt76_tx(struct mt76_phy *phy, struct ieee80211_sta *sta,
 	if (WARN_ON(skb_get_queue_mapping(skb) >= MT_TXQ_PSD))
 		skb_set_queue_mapping(skb, MT_TXQ_BE);
 
-	if (wcid && !(wcid->tx_info & MT_WCID_TX_INFO_SET))
+	if (!(wcid->tx_info & MT_WCID_TX_INFO_SET))
 		ieee80211_get_tx_rates(info->control.vif, sta, skb,
 				       info->control.rates, 1);
 
-- 
2.45.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-03  7:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03  7:48 [PATCH v2] wifi: mt76: fix possible NULL access in mt76_tx Eason Lai

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