* [PATCH v1] wifi: mt76: fix possible NULL access in mt76_tx
@ 2026-11-26 8:22 Eason Lai
2026-11-26 13:33 ` Ben Greear
0 siblings, 1 reply; 2+ messages in thread
From: Eason Lai @ 2026-11-26 8:22 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(!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>
---
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 d8036466f495..2be43d05c9af 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(!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] 2+ messages in thread* Re: [PATCH v1] wifi: mt76: fix possible NULL access in mt76_tx
2026-11-26 8:22 [PATCH v1] wifi: mt76: fix possible NULL access in mt76_tx Eason Lai
@ 2026-11-26 13:33 ` Ben Greear
0 siblings, 0 replies; 2+ messages in thread
From: Ben Greear @ 2026-11-26 13:33 UTC (permalink / raw)
To: Eason Lai, nbd, lorenzo
Cc: linux-wireless, linux-mediatek, kun.wu, deren.wu, sean.wang,
quan.zhou, ryder.lee, leon.yen, litien.chang, jb.tsai,
Anthony Liu
On 11/26/26 12:22 AM, Eason Lai wrote:
> Add WARN_ON(!wcid) early return and drop redundant wcid NULL check
Maybe WARN_ON_ONCE is better, to decrease potential log spam in
case this problem can happen often in some cases?
Thanks,
Ben
>
> 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>
> ---
> 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 d8036466f495..2be43d05c9af 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(!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);
>
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-26 13:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26 8:22 [PATCH v1] wifi: mt76: fix possible NULL access in mt76_tx Eason Lai
2026-11-26 13:33 ` Ben Greear
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox