Skip to content

Commit

Permalink
eventdev: fix possible array underflow/overflow
Browse files Browse the repository at this point in the history
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: 3810ae4 ("eventdev: add interrupt driven queues to Rx adapter")
Cc: [email protected]

Signed-off-by: Bruce Richardson <[email protected]>
Acked-by: Jerin Jacob <[email protected]>
  • Loading branch information
bruce-richardson authored and jerinjacobk committed Nov 18, 2024
1 parent 1f41dea commit 952b24b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/eventdev/rte_event_eth_rx_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 952b24b

Please sign in to comment.