From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Zhao Li <enderaoelyther@gmail.com>
Cc: Felix Fietkau <nbd@nbd.name>, Ryder Lee <ryder.lee@mediatek.com>,
Shayne Chen <shayne.chen@mediatek.com>,
Sean Wang <sean.wang@mediatek.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Chad Monroe <chad@monroe.io>,
Peter Chiu <chui-hao.chiu@mediatek.com>,
StanleyYP Wang <StanleyYP.Wang@mediatek.com>,
Dylan Eskew <dylan.eskew@candelatech.com>,
Bo Jiao <Bo.Jiao@mediatek.com>,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org
Subject: Re: [PATCH] wifi: mt76: mt7996: check the RX WCID before using its station link
Date: Mon, 16 Nov 2026 09:48:47 +0100 [thread overview]
Message-ID: <avrDbwXDBCSbYcNx@lore-desk> (raw)
In-Reply-To: <20261115172723.34964-1-enderaoelyther@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2311 bytes --]
> mt7996_rx_get_wcid() returns NULL when the reported WLAN index does not
> map to a station entry on a valid band. Commit a3ea1c309bf3 ("wifi:
> mt76: mt7996: Fix mt7996_reverse_frag0_hdr_trans for MLO") made
> mt7996_reverse_frag0_hdr_trans() load msta_link->sta while declaring its
> locals, ahead of the !msta check that used to reject a NULL WCID. A
> header-translated first fragment without a station WCID now
> dereferences a NULL pointer in the receive path.
>
> Check the link before loading its station pointer.
>
> Found by code review and not reproduced; compile-tested only.
>
> AI assistance was used.
>
> Fixes: a3ea1c309bf3 ("wifi: mt76: mt7996: Fix mt7996_reverse_frag0_hdr_trans for MLO")
> Cc: stable@vger.kernel.org
> Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
> drivers/net/wireless/mediatek/mt76/mt7996/mac.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
> index f36da545045b..186216f21d28 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
> @@ -191,12 +191,12 @@ static int mt7996_reverse_frag0_hdr_trans(struct sk_buff *skb, u16 hdr_gap)
> struct mt76_rx_status *status = (struct mt76_rx_status *)skb->cb;
> struct ethhdr *eth_hdr = (struct ethhdr *)(skb->data + hdr_gap);
> struct mt7996_sta_link *msta_link = (void *)status->wcid;
> - struct mt7996_sta *msta = msta_link->sta;
> struct ieee80211_bss_conf *link_conf;
> __le32 *rxd = (__le32 *)skb->data;
> struct ieee80211_sta *sta;
> struct ieee80211_vif *vif;
> struct ieee80211_hdr hdr;
> + struct mt7996_sta *msta;
> u16 frame_control;
>
> if (le32_get_bits(rxd[3], MT_RXD3_NORMAL_ADDR_TYPE) !=
> @@ -206,6 +206,10 @@ static int mt7996_reverse_frag0_hdr_trans(struct sk_buff *skb, u16 hdr_gap)
> if (!(le32_to_cpu(rxd[1]) & MT_RXD1_NORMAL_GROUP_4))
> return -EINVAL;
>
> + if (!msta_link)
> + return -EINVAL;
> +
> + msta = msta_link->sta;
> if (!msta || !msta->vif)
> return -EINVAL;
>
>
> base-commit: 5dbf2415ca9821a611d09308e3b29d2c37e7cd77
> --
> 2.56.1
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
prev parent reply other threads:[~2026-11-16 8:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-15 17:27 [PATCH] wifi: mt76: mt7996: check the RX WCID before using its station link Zhao Li
2026-11-16 8:48 ` Lorenzo Bianconi [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=avrDbwXDBCSbYcNx@lore-desk \
--to=lorenzo@kernel.org \
--cc=Bo.Jiao@mediatek.com \
--cc=StanleyYP.Wang@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=chad@monroe.io \
--cc=chui-hao.chiu@mediatek.com \
--cc=dylan.eskew@candelatech.com \
--cc=enderaoelyther@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=nbd@nbd.name \
--cc=ryder.lee@mediatek.com \
--cc=sean.wang@mediatek.com \
--cc=shayne.chen@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