wifi: mt76: mt7925: drop redundant chandef.chan NULL check in MT7927 path

In mt7925_mac_link_bss_add(), the MT7927 branch added an else-if that
checked mvif->phy->mt76->chandef.chan before assigning it to the local
chan pointer. If that check failed, chan stayed NULL and chan->band was
dereferenced unconditionally a line later.

phy->chandef.chan is set during phy registration in mt76_check_sband()
and is never cleared, so the check is a no-op. Drop it and use the
chandef channel as an unconditional fallback, matching the assumption
made elsewhere in the driver (e.g. the existing basic_rates_idx
selection right below this block and mt7925/mac.c).

Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>
Closes: https://lore.kernel.org/r/[email protected]/
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Felix Fietkau
2026-06-01 13:59:24 +02:00
parent 934f647104
commit 1ba5cc4b40
+2 -2
View File
@@ -398,11 +398,11 @@ static int mt7925_mac_link_bss_add(struct mt792x_dev *dev,
mconf->mt76.band_idx = 0xff; mconf->mt76.band_idx = 0xff;
if (is_mt7927(&dev->mt76)) { if (is_mt7927(&dev->mt76)) {
struct ieee80211_channel *chan = NULL; struct ieee80211_channel *chan;
if (link_conf->chanreq.oper.chan) if (link_conf->chanreq.oper.chan)
chan = link_conf->chanreq.oper.chan; chan = link_conf->chanreq.oper.chan;
else if (mvif->phy->mt76->chandef.chan) else
chan = mvif->phy->mt76->chandef.chan; chan = mvif->phy->mt76->chandef.chan;
mconf->mt76.band_idx = mt7927_band_idx(chan->band); mconf->mt76.band_idx = mt7927_band_idx(chan->band);