Skip to contentSkip to conversation

eventdev: fix possible array underflow/overflow

PATCH Applied Bruce Richardson 2 participants 2 messages Nov 14, 2024 – Nov 18, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 eventdev: fix possible array underflow/overflow

If the number of interrupts is zero, then indexing an array by "nb_rx_intr - 1" will cause an out-of-bounds write Fix this by putting in a check that nb_rx_intr > 0 before doing the array write.

Coverity issue: 448870

Fixes 3810ae435783 ("eventdev: add interrupt driven queues to Rx adapter")
---
 lib/eventdev/rte_event_eth_rx_adapter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/eventdev/rte_event_eth_rx_adapter.c +1 -1
index 3ee20d95f3..39674c4604 100644
@@ -2299,7 +2299,7 @@ rxa_sw_add(struct event_eth_rx_adapter *rx_adapter, uint16_t eth_dev_id,
 			for (i = 0; i < dev_info->dev->data->nb_rx_queues; i++)
 				dev_info->intr_queue[i] = i;
 		} else {
-			if (!rxa_intr_queue(dev_info, rx_queue_id))
+			if (!rxa_intr_queue(dev_info, rx_queue_id) && nb_rx_intr > 0)
 				dev_info->intr_queue[nb_rx_intr - 1] =
 					rx_queue_id;
 		}
Signature · 1 line
2.43.0
Acked-by on v1 1/1 Applied
#1 lore raw
Quoted 17 lines

-----Original Message-----
From: Bruce Richardson <[email protected]>
Sent: Thursday, November 14, 2024 5:26 PM
To: [email protected]
Cc: Bruce Richardson <[email protected]>; [email protected]; Naga Harish K S V <[email protected]>; Jerin Jacob <[email protected]>; Nikhil Rao <[email protected]>
Subject: [EXTERNAL] [PATCH] eventdev: fix possible array underflow/overflow

If the number of interrupts is zero, then indexing an array by "nb_rx_intr - 1" will cause an out-of-bounds write Fix this by putting in a check that nb_rx_intr > 0 before doing the array write. Coverity issue: 448870 Fixes: 3810ae435783

If the number of interrupts is zero, then indexing an array by "nb_rx_intr - 1" will cause an out-of-bounds write Fix this by putting in a check that nb_rx_intr

Quoted 7 lines
Quoted 1 line

0 before doing the array write.

Coverity issue: 448870

Fixes 3810ae435783 ("eventdev: add interrupt driven queues to Rx adapter")

Applied to dpdk-next-eventdev/for-main. Thanks

Quoted 22 lines
---
 lib/eventdev/rte_event_eth_rx_adapter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/eventdev/rte_event_eth_rx_adapter.c +1 -1
index 3ee20d95f3..39674c4604 100644
@@ -2299,7 +2299,7 @@ rxa_sw_add(struct event_eth_rx_adapter
 *rx_adapter, uint16_t eth_dev_id,
 			for (i = 0; i < dev_info->dev->data->nb_rx_queues; i++)
 				dev_info->intr_queue[i] = i;
 		} else {
-			if (!rxa_intr_queue(dev_info, rx_queue_id))
+			if (!rxa_intr_queue(dev_info, rx_queue_id) &&
 nb_rx_intr > 0)
 				dev_info->intr_queue[nb_rx_intr - 1] =
lib/eventdev/rte_event_eth_rx_adapter.c +0 -1
 					rx_queue_id;
 		}
--

2.43.0