Skip to content

Commit

Permalink
Merge pull request #57 from changsu-kimm/memory_leak
Browse files Browse the repository at this point in the history
Fix to free pages
  • Loading branch information
cneely-amd authored Mar 14, 2024
2 parents 7b3f8e8 + 33602d3 commit 1cf2578
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions onic_netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,8 @@ static void onic_clear_rx_queue(struct onic_private *priv, u16 qid)
{
struct onic_rx_queue *q = priv->rx_queue[qid];
struct onic_ring *ring;
u32 size;
int real_count;
u32 size, real_count;
int i;

if (!q)
return;
Expand Down Expand Up @@ -441,6 +441,11 @@ static void onic_clear_rx_queue(struct onic_private *priv, u16 qid)
dma_free_coherent(&priv->pdev->dev, size, ring->desc,
ring->dma_addr);

for (i = 0; i < real_count; ++i) {
struct page *pg = q->buffer[i].pg;
__free_pages(pg, 0);
}

kfree(q->buffer);
kfree(q);
priv->rx_queue[qid] = NULL;
Expand Down

0 comments on commit 1cf2578

Please sign in to comment.