net: vmxnet3: check for device_active before write
PATCH 1/1 net: vmxnet3: check for device_active before write
From: Li Qiang <[email protected]>
Vmxnet3 device emulator does not check if the device is active, before using it for write. It leads to a use after free issue, if the vmxnet3_io_bar0_write routine is called after the device is deactivated. Add check to avoid it.
--- hw/net/vmxnet3.c | 4 ++++ 1 file changed, 4 insertions(+)
hw/net/vmxnet3.c +4 -0
@@ -1167,6 +1167,10 @@ vmxnet3_io_bar0_write(void *opaque, hwaddr addr, {VMXNET3State *s = opaque; +if (!s->device_active) { +return ; + } +if (VMW_IS_MULTIREG_ADDR (addr,VMXNET3_REG_TXPROD ,VMXNET3_DEVICE_MAX_TX_QUEUES ,VMXNET3_REG_ALIGN )) { int tx_queue_idx =
Signature · 1 line
2.5.5
Quoted 33 lines · P J P
From: Li Qiang <[email protected]>
Vmxnet3 device emulator does not check if the device is active, before using it for write. It leads to a use after free issue, if the
vmxnet3_io_bar0_writeroutine is called after the device is deactivated. Add check to avoid it.Reported-by Li Qiang <[email protected]>Signed-off-by Prasad J Pandit <[email protected]>---
hw/net/vmxnet3.c| 4 ++++1 file changed, 4 insertions(+)hw/net/vmxnet3.c +4
-0@@ -1167,6 +1167,10 @@ vmxnet3_io_bar0_write(void *opaque, hwaddr addr, {VMXNET3State *s = opaque; +if (!s->device_active) { +return ; + } +if (VMW_IS_MULTIREG_ADDR (addr,VMXNET3_REG_TXPROD ,VMXNET3_DEVICE_MAX_TX_QUEUES ,VMXNET3_REG_ALIGN )) { int tx_queue_idx =Signature · 1 line
2.5.5
Jason Wang
AppliedQuoted 25 lines · Dmitry Fleytman
Acked-by Dmitry Fleytman <[email protected]>Quoted 23 lines · P J P
From: Li Qiang <[email protected]>
Vmxnet3 device emulator does not check if the device is active, before using it for write. It leads to a use after free issue, if the
vmxnet3_io_bar0_writeroutine is called after the device is deactivated. Add check to avoid it.Reported-by Li Qiang <[email protected]>Signed-off-by Prasad J Pandit <[email protected]>---
hw/net/vmxnet3.c| 4 ++++1 file changed, 4 insertions(+)hw/net/vmxnet3.c +0
-0@@ -1167,6 +1167,10 @@ vmxnet3_io_bar0_write(void *opaque, hwaddr addr, {VMXNET3State *s = opaque;
Quoted 10 lines
Quoted 10 lines
hw/net/vmxnet3.c +4
-0+if (!s->device_active) { +return ; + } +if (VMW_IS_MULTIREG_ADDR (addr,VMXNET3_REG_TXPROD ,VMXNET3_DEVICE_MAX_TX_QUEUES ,VMXNET3_REG_ALIGN )) { int tx_queue_idx =Signature · 1 line
2.5.5
Applied, thanks.