hw/net/vmxnet3: Correct bounds check on tx queue index
PATCH 1/1 hw/net/vmxnet3: Correct bounds check on tx queue index
In vmxnet3_io_bar0_write(), we try to bounds-check the TX queue index provided by the guest against the total number of queues. However, we have an off-by-one error: the valid indexes are from 0 to txq_num-1, so we need a "<" comparison, not "<=".
Cc: [email protected]
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3780
--- hw/net/vmxnet3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/net/vmxnet3.c +1 -1
@@ -1079,7 +1079,7 @@ vmxnet3_io_bar0_write(void *opaque, hwaddr addr,int tx_queue_idx =VMW_MULTIREG_IDX_BY_ADDR (addr,VMXNET3_REG_TXPROD ,VMXNET3_REG_ALIGN ); -if (tx_queue_idx <= s->txq_num) { +if (tx_queue_idx < s->txq_num) {vmxnet3_process_tx_queue (s, tx_queue_idx); }else { qemu_log_mask(LOG_GUEST_ERROR, "vmxnet3: Illegal TX queue %d/%d\n",
Signature · 1 line
2.43.0
Quoted 11 lines · Peter Maydell
In
vmxnet3_io_bar0_write(), we try to bounds-check the TX queue index provided by the guest against the total number of queues. However, we have an off-by-one error: the valid indexes are from 0 to txq_num-1, so we need a "<" comparison, not "<=".Cc: [email protected]
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3780Signed-off-by Peter Maydell <[email protected]>--- hw/net/vmxnet3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 7 lines · Philippe Mathieu-Daudé
Quoted 5 lines · Peter Maydell
In
vmxnet3_io_bar0_write(), we try to bounds-check the TX queue index provided by the guest against the total number of queues. However, we have an off-by-one error: the valid indexes are from 0 to txq_num-1, so we need a "<" comparison, not "<=".
Quoted 8 lines
Quoted 6 lines
Cc: [email protected]
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3780Signed-off-by Peter Maydell <[email protected]>--- hw/net/vmxnet3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Thanks; I'll take this via target-arm.next as I'm putting together a pullreq.
-- PMM