[PATCH 2/2] wifi: mt76: mt7615: fix NULL pointer dereference in mt7615_get_status_freq_info

YuanZhe Liu 25031212351 at stu.xidian.edu.cn
Mon Nov 16 03:50:28 PST 2026


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 at vger.kernel.org
Co-developed-by: Bin Yu <byu at xidian.edu.cn>
Signed-off-by: Bin Yu <byu at xidian.edu.cn>
Co-developed-by: Cheng Wen <wencheng at xidian.edu.cn>
Signed-off-by: Cheng Wen <wencheng at xidian.edu.cn>
Signed-off-by: YuanZhe Liu <25031212351 at 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




More information about the Linux-mediatek mailing list