Skip to content

Commit dcbc13d

Browse files
LorenzoBianconigregkh
authored andcommitted
wifi: mt76: Fix memory leak destroying device
[ Upstream commit 6b470f3 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 35835ff commit dcbc13d

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
@@ -878,7 +878,12 @@ mt76_dma_rx_cleanup(struct mt76_dev *dev, struct mt76_queue *q)
878878
if (!buf)
879879
break;
880880

881-
if (!mt76_queue_is_wed_rro(q))
881+
if (mtk_wed_device_active(&dev->mmio.wed) &&
882+
mt76_queue_is_wed_rro(q))
883+
continue;
884+
885+
if (!mt76_queue_is_wed_rro_rxdmad_c(q) &&
886+
!mt76_queue_is_wed_rro_ind(q))
882887
mt76_put_page_pool_buf(buf, false);
883888
} while (1);
884889

@@ -1169,10 +1174,6 @@ void mt76_dma_cleanup(struct mt76_dev *dev)
11691174
mt76_for_each_q_rx(dev, i) {
11701175
struct mt76_queue *q = &dev->q_rx[i];
11711176

1172-
if (mtk_wed_device_active(&dev->mmio.wed) &&
1173-
mt76_queue_is_wed_rro(q))
1174-
continue;
1175-
11761177
netif_napi_del(&dev->napi[i]);
11771178
mt76_dma_rx_cleanup(dev, q);
11781179

0 commit comments

Comments
 (0)