From: Zhao Li <enderaoelyther@gmail.com>
To: Ziheng Wei <zihengw03@163.com>
Cc: Felix Fietkau <nbd@nbd.name>,
Lorenzo Bianconi <lorenzo@kernel.org>,
Ryder Lee <ryder.lee@mediatek.com>,
Shayne Chen <shayne.chen@mediatek.com>,
Sean Wang <sean.wang@mediatek.com>,
linux-wireless@vger.kernel.org,
linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] wifi: mt76: mt7925: fix mt7925_reverse_frag0_hdr_trans() for MLO
Date: Mon, 16 Nov 2026 03:27:25 +0800 [thread overview]
Message-ID: <20261115192725.8230-1-enderaoelyther@gmail.com> (raw)
In-Reply-To: <20261115080239.910402-1-zihengw03@163.com>
Hi Ziheng,
On Sun, Nov 15, 2026 at 04:02:39PM +0800, Ziheng Wei wrote:
> - struct mt792x_sta *msta = (struct mt792x_sta *)status->wcid;
> + struct mt792x_link_sta *mlink = (struct mt792x_link_sta *)status->wcid;
> + struct mt792x_sta *msta = mlink ? mlink->sta : NULL;
The MLO part is right, but the cast still needs a guard, and the
MT_RXD3_NORMAL_U2M check below does not provide one: it selects the
unguarded path. mt7925_mac_fill_rx() computes unicast from the same
rxd3 comparison, so every frame that gets past that check arrived
through the one branch of mt792x_rx_get_wcid() that returns the WTBL
entry as it found it:
wcid = mt76_wcid_ptr(dev, idx);
if (unicast || !wcid)
return wcid;
if (!wcid->sta)
return NULL;
Not every entry is a station link. mt792x_init_wcid() reserves index 0
for beacons and management frames and installs dev->mt76.global_wcid
there, a bare struct mt76_wcid inside struct mt76_dev, immediately
followed by the wcid[] table. For that entry, mlink->sta reads at the
offset mt792x_link_sta keeps its back pointer at, which lands in that
table, and msta->vif then dereferences whatever it found, so the header
is still built from a type-confused object. I can't say whether the
hardware reports index 0 for a header-translated unicast fragment, but
the non-unicast path in the same helper already guards its container_of()
with wcid->sta.
Doing the same here keeps the conversion valid for every entry, with
mlink and msta left uninitialized in the declarations:
if (!status->wcid || !status->wcid->sta)
return -EINVAL;
mlink = container_of(status->wcid, struct mt792x_link_sta, wcid);
msta = mlink->sta;
if (!msta || !msta->vif)
return -EINVAL;
> + link_conf = rcu_dereference(vif->link_conf[mlink->wcid.link_id]);
> + if (!sta || !link_conf)
> + return -EINVAL;
With status->wcid->sta checked above, wcid_to_sta() cannot return NULL
here, so only !link_conf needs to be tested. The per-link BSSID lookup
matches what a3ea1c309bf3 did for mt7996.
Thanks,
Zhao
prev parent reply other threads:[~2026-11-15 19:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-15 8:02 [PATCH] wifi: mt76: mt7925: fix mt7925_reverse_frag0_hdr_trans() for MLO Ziheng Wei
2026-11-15 19:27 ` Zhao Li [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=20261115192725.8230-1-enderaoelyther@gmail.com \
--to=enderaoelyther@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=nbd@nbd.name \
--cc=ryder.lee@mediatek.com \
--cc=sean.wang@mediatek.com \
--cc=shayne.chen@mediatek.com \
--cc=zihengw03@163.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