* [PATCH 08/21] net/ena: rework sanity checks
@ 2025-10-15 7:10 Shai Brandes
0 siblings, 0 replies; only message in thread
From: Shai Brandes @ 2025-10-15 7:10 UTC (permalink / raw)
To: stephen; +Cc: dev, Shai Brandes, Amit Bernstein
1. Accurately check the return status of rte_intr_callback_unregister_sync
2. Add sanity checks of ring pointer on IO queue release
Signed-off-by: Amit Bernstein <amitbern@amazon.com>
Signed-off-by: Shai Brandes <shaibran@amazon.com>
Reviewed-by: Yosef Raisman <yraisman@amazon.com>
---
drivers/net/ena/ena_ethdev.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index a2863f1e22..568aca1152 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -939,8 +939,8 @@ static int ena_close(struct rte_eth_dev *dev)
if (!adapter->control_path_poll_interval) {
rte_intr_disable(intr_handle);
rc = rte_intr_callback_unregister_sync(intr_handle, ena_control_path_handler, dev);
- if (unlikely(rc != 0))
- PMD_INIT_LOG_LINE(ERR, "Failed to unregister interrupt handler");
+ if (unlikely(rc < 0))
+ PMD_INIT_LOG_LINE(ERR, "Failed to unregister interrupt handler (%d)", rc);
} else {
rte_eal_alarm_cancel(ena_control_path_poll_handler, dev);
}
@@ -1020,6 +1020,9 @@ static void ena_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid)
{
struct ena_ring *ring = dev->data->rx_queues[qid];
+ if (!ring)
+ return;
+
/* Free ring resources */
rte_free(ring->rx_buffer_info);
ring->rx_buffer_info = NULL;
@@ -1040,6 +1043,9 @@ static void ena_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid)
{
struct ena_ring *ring = dev->data->tx_queues[qid];
+ if (!ring)
+ return;
+
/* Free ring resources */
rte_free(ring->push_buf_intermediate_buf);
--
2.17.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-10-15 7:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-15 7:10 [PATCH 08/21] net/ena: rework sanity checks Shai Brandes
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).