Skip to content

Commit 93fa5a1

Browse files
LorenzoBianconiopsiff
authored andcommitted
wifi: mt76: Fix memory leak destroying device
mainline inclusion from mainline-v7.1-rc1 category: bugfix All MT76 rx queues have an associated page_pool even if the queue is not associated to a NAPI (e.g. WED RRO queues with WED enabled). Destroy the page_pool running mt76_dma_cleanup routine during module unload. Moreover returns pages to the page pool if WED is not enabled for WED RRO queues. Fixes: 950d0ab ("wifi: mt76: mt7996: add wed rx support") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Link: https://patch.msgid.link/20251208-mt76-fix-memory-leak-v1-1-cba813fc62b8@kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name> (cherry picked from commit 6b470f36616e3448d44b0ef4b1de2a3e3a31b5be) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
1 parent 515dd19 commit 93fa5a1

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

  • drivers/net/wireless/mediatek/mt76

drivers/net/wireless/mediatek/mt76/dma.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,12 @@ mt76_dma_rx_cleanup(struct mt76_dev *dev, struct mt76_queue *q)
754754
if (!buf)
755755
break;
756756

757-
if (!mt76_queue_is_wed_rro(q))
757+
if (mtk_wed_device_active(&dev->mmio.wed) &&
758+
mt76_queue_is_wed_rro(q))
759+
continue;
760+
761+
if (!mt76_queue_is_wed_rro_rxdmad_c(q) &&
762+
!mt76_queue_is_wed_rro_ind(q))
758763
mt76_put_page_pool_buf(buf, false);
759764
} while (1);
760765

@@ -1001,10 +1006,6 @@ void mt76_dma_cleanup(struct mt76_dev *dev)
10011006
mt76_for_each_q_rx(dev, i) {
10021007
struct mt76_queue *q = &dev->q_rx[i];
10031008

1004-
if (mtk_wed_device_active(&dev->mmio.wed) &&
1005-
mt76_queue_is_wed_rro(q))
1006-
continue;
1007-
10081009
netif_napi_del(&dev->napi[i]);
10091010
mt76_dma_rx_cleanup(dev, q);
10101011

0 commit comments

Comments
 (0)