Made it so that vmxnet3_validate_interrupts will always validate s->rxq_descr[0].intr_idx.
Signed-off-by: Andrew Nguyen <[email protected]> Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4729 --- This is a resolution for issue #4729: https://gitlab.com/qemu-project/qemu/-/work_items/4729. >From the report, I got the impression that rxq_descr[0] will always "exist" >even if the value of rxq_num is 0. This is because RXQ_IDX is 0. Therefore, my solution is to always validate rxq_descr[0].intr_idx. To: [email protected] Cc: Dmitry Fleytman <[email protected]> Signed-off-by: Andrew Nguyen <[email protected]> Changes: - vmxnet3.c: changed the RX queue interrupt index validation for loop to a do-while loop --- hw/net/vmxnet3.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c index 24c551a054..58bb7fb869 100644 --- a/hw/net/vmxnet3.c +++ b/hw/net/vmxnet3.c @@ -1367,13 +1367,15 @@ static bool vmxnet3_validate_interrupts(VMXNET3State *s) } } - for (i = 0; i < s->rxq_num; i++) { + i = 0; + do { int idx = s->rxq_descr[i].intr_idx; VMW_CFPRN("Verifying RX queue %d interrupt index (%d)", i, idx); if (!vmxnet3_validate_irq_idx("RX", s->msix_used, idx)) { return false; } - } + i++; + } while (i < s->rxq_num); return true; } --- base-commit: e9fa1f66f0d47c74b6766e1b8b87ad7c2a9394d5 change-id: 20261115-4729-out-of-bounds-rx-interrupt-idx-78d69a7d847d Best regards, -- Andrew Nguyen <[email protected]>
