Skip to contentSkip to conversation

ice: Fix missing cleanup routine in the case of partial memory allocation

PATCH In review Martyna Szapar-Mudlaw 2 participants 2 messages Feb 13, 2023 – Feb 16, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ice: Fix missing cleanup routine in the case of partial memory allocation

Add missing memory free in the case of partial memory allocation in the loop in ice_realloc_zc_buf function.

Fixes 7e753eb675f0 ("ice: Fix DMA mappings leak")
---
 drivers/net/ethernet/intel/ice/ice_xsk.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_xsk.c +9 -1
index 7105de6fb344..0b025a36e6f1 100644
@@ -377,8 +377,16 @@ int ice_realloc_zc_buf(struct ice_vsi *vsi, bool zc)
 	for_each_set_bit(q, vsi->af_xdp_zc_qps,
 			 max_t(int, vsi->alloc_txq, vsi->alloc_rxq)) {
 		rx_ring = vsi->rx_rings[q];
-		if (ice_realloc_rx_xdp_bufs(rx_ring, zc))
+		if (ice_realloc_rx_xdp_bufs(rx_ring, zc)) {
+			unsigned long qid = q;
+
+			for_each_set_bit(q, vsi->af_xdp_zc_qps, qid) {
+				rx_ring = vsi->rx_rings[q];
+				zc ? kfree(rx_ring->xdp_buf) :
+				     kfree(rx_ring->rx_buf);
+			}
 			return -ENOMEM;
+		}
 	}
 
 	return 0;
Signature · 6 lines
2.36.1

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Tested-by on v1 1/1
#1 lore raw
Quoted 14 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Martyna Szapar-Mudlaw
Sent: 13 February 2023 16:10
To: [email protected]
Cc: Martyna Szapar-Mudlaw <[email protected]>
Subject: [Intel-wired-lan] [PATCH net] ice: Fix missing cleanup routine in the case of partial memory allocation

Add missing memory free in the case of partial memory allocation in the loop in ice_realloc_zc_buf function.

Quoted 8 lines
Fixes 7e753eb675f0 ("ice: Fix DMA mappings leak")
Signed-off-by Martyna Szapar-Mudlaw <martyna.szapar-

[email protected]>

---
drivers/net/ethernet/intel/ice/ice_xsk.c | 10 +++++++++-

1 file changed, 9 insertions(+), 1 deletion(-)

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan