intel-wired-lan.lists.osuosl.org archive mirror
 help / color / mirror / Atom feed
* [Intel-wired-lan] [PATCH net] ice: Fix missing cleanup routine in the case of partial memory allocation
@ 2023-02-13 10:40 Martyna Szapar-Mudlaw
  2023-02-16 15:01 ` Rout, ChandanX
  0 siblings, 1 reply; 2+ messages in thread
From: Martyna Szapar-Mudlaw @ 2023-02-13 10:40 UTC (permalink / raw)
  To: intel-wired-lan; +Cc: Martyna Szapar-Mudlaw

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")
Signed-off-by: Martyna Szapar-Mudlaw <martyna.szapar-mudlaw@linux.intel.com>
Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_xsk.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/ethernet/intel/ice/ice_xsk.c
index 7105de6fb344..0b025a36e6f1 100644
--- a/drivers/net/ethernet/intel/ice/ice_xsk.c
+++ b/drivers/net/ethernet/intel/ice/ice_xsk.c
@@ -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;
-- 
2.36.1

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Intel-wired-lan] [PATCH net] ice: Fix missing cleanup routine in the case of partial memory allocation
  2023-02-13 10:40 [Intel-wired-lan] [PATCH net] ice: Fix missing cleanup routine in the case of partial memory allocation Martyna Szapar-Mudlaw
@ 2023-02-16 15:01 ` Rout, ChandanX
  0 siblings, 0 replies; 2+ messages in thread
From: Rout, ChandanX @ 2023-02-16 15:01 UTC (permalink / raw)
  To: Martyna Szapar-Mudlaw, intel-wired-lan; +Cc: Nagraj, Shravan



>-----Original Message-----
>From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
>Martyna Szapar-Mudlaw
>Sent: 13 February 2023 16:10
>To: intel-wired-lan@osuosl.org
>Cc: Martyna Szapar-Mudlaw <martyna.szapar-mudlaw@linux.intel.com>
>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.
>
>Fixes: 7e753eb675f0 ("ice: Fix DMA mappings leak")
>Signed-off-by: Martyna Szapar-Mudlaw <martyna.szapar-
>mudlaw@linux.intel.com>
>Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
>---
> drivers/net/ethernet/intel/ice/ice_xsk.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>

Tested-by: Chandan Kumar Rout <chandanx.rout@intel.com> (A Contingent Worker at Intel)
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-16 15:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-13 10:40 [Intel-wired-lan] [PATCH net] ice: Fix missing cleanup routine in the case of partial memory allocation Martyna Szapar-Mudlaw
2023-02-16 15:01 ` Rout, ChandanX

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).