Skip to content

Commit 90fa009

Browse files
LorenzoBianconigregkh
authored andcommitted
wifi: mt76: dma: free rx_head in mt76_dma_rx_cleanup
[ Upstream commit 1b88b47 ] Free rx_head skb in mt76_dma_rx_cleanup routine in order to avoid possible memory leak at module unload. Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Felix Fietkau <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 634986c commit 90fa009

File tree

1 file changed

+7
-6
lines changed
  • drivers/net/wireless/mediatek/mt76

1 file changed

+7
-6
lines changed

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -486,13 +486,20 @@ mt76_dma_rx_cleanup(struct mt76_dev *dev, struct mt76_queue *q)
486486
bool more;
487487

488488
spin_lock_bh(&q->lock);
489+
489490
do {
490491
buf = mt76_dma_dequeue(dev, q, true, NULL, NULL, &more);
491492
if (!buf)
492493
break;
493494

494495
skb_free_frag(buf);
495496
} while (1);
497+
498+
if (q->rx_head) {
499+
dev_kfree_skb(q->rx_head);
500+
q->rx_head = NULL;
501+
}
502+
496503
spin_unlock_bh(&q->lock);
497504

498505
if (!q->rx_page.va)
@@ -515,12 +522,6 @@ mt76_dma_rx_reset(struct mt76_dev *dev, enum mt76_rxq_id qid)
515522
mt76_dma_rx_cleanup(dev, q);
516523
mt76_dma_sync_idx(dev, q);
517524
mt76_dma_rx_fill(dev, q);
518-
519-
if (!q->rx_head)
520-
return;
521-
522-
dev_kfree_skb(q->rx_head);
523-
q->rx_head = NULL;
524525
}
525526

526527
static void

0 commit comments

Comments
 (0)