This is a note to let you know that I've just added the patch titled ice: xsk: Fix cleaning of XDP_TX frames to the 6.1-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: ice-xsk-fix-cleaning-of-xdp_tx-frames.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 1f090494170ea298530cf1285fb8d078e355b4c0 Mon Sep 17 00:00:00 2001 From: Larysa Zaremba <larysa.zaremba@xxxxxxxxx> Date: Thu, 9 Feb 2023 17:01:30 +0100 Subject: ice: xsk: Fix cleaning of XDP_TX frames From: Larysa Zaremba <larysa.zaremba@xxxxxxxxx> commit 1f090494170ea298530cf1285fb8d078e355b4c0 upstream. Incrementation of xsk_frames inside the for-loop produces infinite loop, if we have both normal AF_XDP-TX and XDP_TXed buffers to complete. Split xsk_frames into 2 variables (xsk_frames and completed_frames) to eliminate this bug. Fixes: 29322791bc8b ("ice: xsk: change batched Tx descriptor cleaning") Acked-by: Maciej Fijalkowski <maciej.fijalkowski@xxxxxxxxx> Signed-off-by: Larysa Zaremba <larysa.zaremba@xxxxxxxxx> Reviewed-by: Alexander Duyck <alexanderduyck@xxxxxx> Acked-by: Tony Nguyen <anthony.l.nguyen@xxxxxxxxx> Link: https://lore.kernel.org/r/20230209160130.1779890-1-larysa.zaremba@xxxxxxxxx Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/net/ethernet/intel/ice/ice_xsk.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) --- a/drivers/net/ethernet/intel/ice/ice_xsk.c +++ b/drivers/net/ethernet/intel/ice/ice_xsk.c @@ -789,6 +789,7 @@ static void ice_clean_xdp_irq_zc(struct struct ice_tx_desc *tx_desc; u16 cnt = xdp_ring->count; struct ice_tx_buf *tx_buf; + u16 completed_frames = 0; u16 xsk_frames = 0; u16 last_rs; int i; @@ -798,19 +799,21 @@ static void ice_clean_xdp_irq_zc(struct if ((tx_desc->cmd_type_offset_bsz & cpu_to_le64(ICE_TX_DESC_DTYPE_DESC_DONE))) { if (last_rs >= ntc) - xsk_frames = last_rs - ntc + 1; + completed_frames = last_rs - ntc + 1; else - xsk_frames = last_rs + cnt - ntc + 1; + completed_frames = last_rs + cnt - ntc + 1; } - if (!xsk_frames) + if (!completed_frames) return; - if (likely(!xdp_ring->xdp_tx_active)) + if (likely(!xdp_ring->xdp_tx_active)) { + xsk_frames = completed_frames; goto skip; + } ntc = xdp_ring->next_to_clean; - for (i = 0; i < xsk_frames; i++) { + for (i = 0; i < completed_frames; i++) { tx_buf = &xdp_ring->tx_buf[ntc]; if (tx_buf->raw_buf) { @@ -826,7 +829,7 @@ static void ice_clean_xdp_irq_zc(struct } skip: tx_desc->cmd_type_offset_bsz = 0; - xdp_ring->next_to_clean += xsk_frames; + xdp_ring->next_to_clean += completed_frames; if (xdp_ring->next_to_clean >= cnt) xdp_ring->next_to_clean -= cnt; if (xsk_frames) Patches currently in stable-queue which might be from larysa.zaremba@xxxxxxxxx are queue-6.1/ice-xsk-fix-cleaning-of-xdp_tx-frames.patch