Skip to content

Commit

Permalink
xsk: recycle buffer in case Rx queue was full
Browse files Browse the repository at this point in the history
Add missing xsk_buff_free() call when __xsk_rcv_zc() failed to produce
descriptor to XSK Rx queue.

Fixes: 24ea501 ("xsk: support mbuf on ZC RX")
Signed-off-by: Maciej Fijalkowski <[email protected]>
  • Loading branch information
mfijalko authored and intel-lab-lkp committed Dec 12, 2023
1 parent e307b5a commit 5e11c9c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions net/xdp/xsk.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,10 @@ static int xsk_rcv_zc(struct xdp_sock *xs, struct xdp_buff *xdp, u32 len)
contd = XDP_PKT_CONTD;

err = __xsk_rcv_zc(xs, xskb, len, contd);
if (err || likely(!frags))
goto out;
if (err)
goto err;
if (likely(!frags))
return 0;

xskb_list = &xskb->pool->xskb_list;
list_for_each_entry_safe(pos, tmp, xskb_list, xskb_list_node) {
Expand All @@ -177,11 +179,13 @@ static int xsk_rcv_zc(struct xdp_sock *xs, struct xdp_buff *xdp, u32 len)
len = pos->xdp.data_end - pos->xdp.data;
err = __xsk_rcv_zc(xs, pos, len, contd);
if (err)
return err;
goto err;
list_del(&pos->xskb_list_node);
}

out:
return 0;
err:
xsk_buff_free(xdp);
return err;
}

Expand Down

0 comments on commit 5e11c9c

Please sign in to comment.