mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-19 20:05:08 +00:00
xsk: recycle buffer in case Rx queue was full
Add missing xsk_buff_free() call when __xsk_rcv_zc() failed to produce descriptor to XSK Rx queue. Fixes: 24ea50127ecf ("xsk: support mbuf on ZC RX") Acked-by: Magnus Karlsson <magnus.karlsson@intel.com> Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com> Link: https://lore.kernel.org/r/20240124191602.566724-2-maciej.fijalkowski@intel.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
parent
1732ebc4a2
commit
2690098931
@ -167,8 +167,10 @@ static int xsk_rcv_zc(struct xdp_sock *xs, struct xdp_buff *xdp, u32 len)
|
|||||||
contd = XDP_PKT_CONTD;
|
contd = XDP_PKT_CONTD;
|
||||||
|
|
||||||
err = __xsk_rcv_zc(xs, xskb, len, contd);
|
err = __xsk_rcv_zc(xs, xskb, len, contd);
|
||||||
if (err || likely(!frags))
|
if (err)
|
||||||
goto out;
|
goto err;
|
||||||
|
if (likely(!frags))
|
||||||
|
return 0;
|
||||||
|
|
||||||
xskb_list = &xskb->pool->xskb_list;
|
xskb_list = &xskb->pool->xskb_list;
|
||||||
list_for_each_entry_safe(pos, tmp, xskb_list, xskb_list_node) {
|
list_for_each_entry_safe(pos, tmp, xskb_list, xskb_list_node) {
|
||||||
@ -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;
|
len = pos->xdp.data_end - pos->xdp.data;
|
||||||
err = __xsk_rcv_zc(xs, pos, len, contd);
|
err = __xsk_rcv_zc(xs, pos, len, contd);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
goto err;
|
||||||
list_del(&pos->xskb_list_node);
|
list_del(&pos->xskb_list_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
return 0;
|
||||||
|
err:
|
||||||
|
xsk_buff_free(xdp);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user