Skip to content

Commit ecf995b

Browse files
Lucid-Duckgregkh
authored andcommitted
wifi: mt76: mt7921: drop TXRX_NOTIFY on non-mmio buses
commit da4082e upstream. PKT_TYPE_TXRX_NOTIFY is an mmio-only event, but mt7921_rx_check() and mt7921_queue_rx_skb() dispatch it to mt7921_mac_tx_free() on every bus. mt7921_mac_tx_free() cleans the DMA tx queues with mt76_queue_tx_cleanup(), which calls queue_ops->tx_cleanup(). Only the mmio queue ops implement that callback; on USB and SDIO it is NULL, so a TXRX_NOTIFY there calls a NULL pointer in the RX worker: BUG: kernel NULL pointer dereference, address: 0000000000000000 RIP: 0010:0x0 Call Trace: mt7921_mac_tx_free+0x64/0x310 [mt7921_common] mt7921_rx_check+0x5f/0xf0 [mt7921_common] mt76u_rx_worker+0x1b9/0x620 [mt76_usb] Drop the event on non-mmio buses via mt76_is_mmio(), as in commit 5683e14 ("wifi: mt76: connac: do not check WED status for non-mmio devices"). Fixes: 48fab5b ("mt76: mt7921: introduce mt7921s support") Cc: stable@vger.kernel.org Signed-off-by: Devin Wittmayer <lucid_duck@justthetip.ca> Link: https://patch.msgid.link/20260627191336.20223-2-lucid_duck@justthetip.ca Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 88c98ef commit ecf995b

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

  • drivers/net/wireless/mediatek/mt76/mt7921

drivers/net/wireless/mediatek/mt76/mt7921/mac.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -580,8 +580,9 @@ bool mt7921_rx_check(struct mt76_dev *mdev, void *data, int len)
580580

581581
switch (type) {
582582
case PKT_TYPE_TXRX_NOTIFY:
583-
/* PKT_TYPE_TXRX_NOTIFY can be received only by mmio devices */
584-
mt7921_mac_tx_free(dev, data, len); /* mmio */
583+
if (!mt76_is_mmio(mdev))
584+
return false;
585+
mt7921_mac_tx_free(dev, data, len);
585586
return false;
586587
case PKT_TYPE_TXS:
587588
for (rxd += 2; rxd + 8 <= end; rxd += 8)
@@ -610,7 +611,10 @@ void mt7921_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
610611

611612
switch (type) {
612613
case PKT_TYPE_TXRX_NOTIFY:
613-
/* PKT_TYPE_TXRX_NOTIFY can be received only by mmio devices */
614+
if (!mt76_is_mmio(mdev)) {
615+
napi_consume_skb(skb, 1);
616+
break;
617+
}
614618
mt7921_mac_tx_free(dev, skb->data, skb->len);
615619
napi_consume_skb(skb, 1);
616620
break;

0 commit comments

Comments
 (0)