This is a note to let you know that I've just added the patch titled xsk: recycle buffer in case Rx queue was full to the 6.7-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: xsk-recycle-buffer-in-case-rx-queue-was-full.patch and it can be found in the queue-6.7 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit c2fe6af64698a43889e90bbda82f4a926d00e464 Author: Maciej Fijalkowski <maciej.fijalkowski@xxxxxxxxx> Date: Wed Jan 24 20:15:52 2024 +0100 xsk: recycle buffer in case Rx queue was full [ Upstream commit 269009893146c495f41e9572dd9319e787c2eba9 ] 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@xxxxxxxxx> Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@xxxxxxxxx> Link: https://lore.kernel.org/r/20240124191602.566724-2-maciej.fijalkowski@xxxxxxxxx Signed-off-by: Alexei Starovoitov <ast@xxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c index 3da0b52f308d..688e641cd278 100644 --- a/net/xdp/xsk.c +++ b/net/xdp/xsk.c @@ -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) { @@ -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; }