Linux wireless drivers development
 help / color / mirror / Atom feed
From: Ben Greear <greearb@candelatech.com>
To: Eason Lai <eason.lai@mediatek.com>, nbd@nbd.name, lorenzo@kernel.org
Cc: linux-wireless@vger.kernel.org,
	linux-mediatek@lists.infradead.org, kun.wu@mediatek.com,
	deren.wu@mediatek.com, sean.wang@mediatek.com,
	quan.zhou@mediatek.com, ryder.lee@mediatek.com,
	leon.yen@mediatek.com, litien.chang@mediatek.com,
	jb.tsai@mediatek.com, Anthony Liu <anthony.liu@mediatek.com>
Subject: Re: [PATCH v1] wifi: mt76: fix possible NULL access in mt76_tx
Date: Thu, 26 Nov 2026 05:33:47 -0800	[thread overview]
Message-ID: <a7776ad1-063b-46be-abb6-f4feaa22e12e@candelatech.com> (raw)
In-Reply-To: <20261126082228.3226934-1-eason.lai@mediatek.com>

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

      reply	other threads:[~2026-11-26 13:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

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=a7776ad1-063b-46be-abb6-f4feaa22e12e@candelatech.com \
    --to=greearb@candelatech.com \
    --cc=anthony.liu@mediatek.com \
    --cc=deren.wu@mediatek.com \
    --cc=eason.lai@mediatek.com \
    --cc=jb.tsai@mediatek.com \
    --cc=kun.wu@mediatek.com \
    --cc=leon.yen@mediatek.com \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=litien.chang@mediatek.com \
    --cc=lorenzo@kernel.org \
    --cc=nbd@nbd.name \
    --cc=quan.zhou@mediatek.com \
    --cc=ryder.lee@mediatek.com \
    --cc=sean.wang@mediatek.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