net/ice: null field checks in ice_{r,t}x_queue_release

Message ID 20221012122757.50488-1-markus.theil@tu-ilmenau.de (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers
Series net/ice: null field checks in ice_{r,t}x_queue_release |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/github-robot: build fail github build: failed

Commit Message

Markus Theil Oct. 12, 2022, 12:27 p.m. UTC
  From: Tomasz Jonak <tomasz@graphiant.com>

In case rte_eth_dma_zone_reserve fails in ice_tx_queue_setup
ice_tx_queue_release is called on 0 allocated but not initialized
txq struct.
This may happen on ENOMEM condition, size exhaustion of
memconfig->memzones array as well as some others.

Signed-off-by: Tomasz Jonak <tomasz@graphiant.com>
---
 drivers/net/ice/ice_rxtx.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
  

Comments

Qi Zhang Oct. 13, 2022, 3:39 a.m. UTC | #1
> -----Original Message-----
> From: Markus Theil <markus.theil@tu-ilmenau.de>
> Sent: Wednesday, October 12, 2022 8:28 PM
> To: dev@dpdk.org
> Cc: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; Tomasz Jonak <tomasz@graphiant.com>
> Subject: [PATCH] net/ice: null field checks in ice_{r,t}x_queue_release
> 
> From: Tomasz Jonak <tomasz@graphiant.com>
> 
> In case rte_eth_dma_zone_reserve fails in ice_tx_queue_setup
> ice_tx_queue_release is called on 0 allocated but not initialized txq struct.
> This may happen on ENOMEM condition, size exhaustion of
> memconfig->memzones array as well as some others.
> 

Added:
Fixes: edec6dd83824 ("net/ice: remove redundant functions")
Cc: stable@dpdk.org

> Signed-off-by: Tomasz Jonak <tomasz@graphiant.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi
  

Patch

diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index 697251c603..953ff217df 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -1302,7 +1302,8 @@  ice_rx_queue_release(void *rxq)
 		return;
 	}
 
-	q->rx_rel_mbufs(q);
+	if (q->rx_rel_mbufs != NULL)
+		q->rx_rel_mbufs(q);
 	rte_free(q->sw_ring);
 	rte_memzone_free(q->mz);
 	rte_free(q);
@@ -1512,7 +1513,8 @@  ice_tx_queue_release(void *txq)
 		return;
 	}
 
-	q->tx_rel_mbufs(q);
+	if (q->tx_rel_mbufs != NULL)
+		q->tx_rel_mbufs(q);
 	rte_free(q->sw_ring);
 	rte_memzone_free(q->mz);
 	rte_free(q);