Skip to content

Commit

Permalink
Fix to free pages
Browse files Browse the repository at this point in the history
This PR fixes a memory leak problem on the page buffers for receiving packets.

Signed-off-by: changsu kim <[email protected]>
  • Loading branch information
changsu-kimm committed Mar 13, 2024
1 parent 7b3f8e8 commit 33602d3
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 33602d3

Please sign in to comment.