mt7615_mac_fill_rx() starts processing received frames as soon as MT76_STATE_INITIALIZED is set, which happens while the device is being initialized, but mphy->chandef.chan is only assigned once mac80211 configures a channel. A frame that arrives before that, while the phy is neither scanning nor doing a remain-on-channel operation, makes mt7615_get_status_freq_info() dereference a NULL channel: general protection fault, probably for non-canonical address 0xdffffc0000000000 RIP: mt7615_get_status_freq_info Call Trace: mt7615_mac_fill_rx mt7615_queue_rx_skb Only report the configured channel when one is available and derive the frequency from the RX descriptor otherwise. Fixes: fcdfc29e58ee3 ("mt76: mt7615: introduce hw scan support") Cc: stable@vger.kernel.org Co-developed-by: Bin Yu Signed-off-by: Bin Yu Co-developed-by: Cheng Wen Signed-off-by: Cheng Wen Signed-off-by: YuanZhe Liu <25031212351@stu.xidian.edu.cn> --- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c index 86c6b443ef71..b6256226b605 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c @@ -199,7 +199,8 @@ static void mt7615_get_status_freq_info(struct mt7615_dev *dev, struct mt76_phy *mphy, struct mt76_rx_status *status, u8 chfreq) { - if (!test_bit(MT76_HW_SCANNING, &mphy->state) && + if (mphy->chandef.chan && + !test_bit(MT76_HW_SCANNING, &mphy->state) && !test_bit(MT76_HW_SCHED_SCANNING, &mphy->state) && !test_bit(MT76_STATE_ROC, &mphy->state)) { status->freq = mphy->chandef.chan->center_freq; -- 2.34.1