* [Qemu-devel] [PATCH] net: vmxnet3: check for device_active before write
@ 2016-08-08 12:38 P J P
2016-08-08 13:08 ` Dmitry Fleytman
0 siblings, 1 reply; 3+ messages in thread
From: P J P @ 2016-08-08 12:38 UTC (permalink / raw)
To: Qemu Developers; +Cc: Jason Wang, Dmitry Fleytman, Li Qiang
From: Li Qiang <liqiang6-s@360.cn>
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.
Reported-by: Li Qiang <liqiang6-s@360.cn>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
---
hw/net/vmxnet3.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
index bbf44ad..90f6943 100644
--- a/hw/net/vmxnet3.c
+++ b/hw/net/vmxnet3.c
@@ -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 =
--
2.5.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] net: vmxnet3: check for device_active before write
2016-08-08 12:38 [Qemu-devel] [PATCH] net: vmxnet3: check for device_active before write P J P
@ 2016-08-08 13:08 ` Dmitry Fleytman
2016-08-09 3:39 ` Jason Wang
0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Fleytman @ 2016-08-08 13:08 UTC (permalink / raw)
To: P J P; +Cc: Qemu Developers, Jason Wang, Li Qiang
Acked-by: Dmitry Fleytman <dmitry@daynix.com>
> On 8 Aug 2016, at 15:38 PM, P J P <ppandit@redhat.com> wrote:
>
> From: Li Qiang <liqiang6-s@360.cn>
>
> 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.
>
> Reported-by: Li Qiang <liqiang6-s@360.cn>
> Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
> ---
> hw/net/vmxnet3.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
> index bbf44ad..90f6943 100644
> --- a/hw/net/vmxnet3.c
> +++ b/hw/net/vmxnet3.c
> @@ -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 =
> --
> 2.5.5
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] net: vmxnet3: check for device_active before write
2016-08-08 13:08 ` Dmitry Fleytman
@ 2016-08-09 3:39 ` Jason Wang
0 siblings, 0 replies; 3+ messages in thread
From: Jason Wang @ 2016-08-09 3:39 UTC (permalink / raw)
To: Dmitry Fleytman, P J P; +Cc: Qemu Developers, Li Qiang
On 2016年08月08日 21:08, Dmitry Fleytman wrote:
> Acked-by: Dmitry Fleytman <dmitry@daynix.com>
>
>> On 8 Aug 2016, at 15:38 PM, P J P <ppandit@redhat.com> wrote:
>>
>> From: Li Qiang <liqiang6-s@360.cn>
>>
>> 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.
>>
>> Reported-by: Li Qiang <liqiang6-s@360.cn>
>> Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
>> ---
>> hw/net/vmxnet3.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
>> index bbf44ad..90f6943 100644
>> --- a/hw/net/vmxnet3.c
>> +++ b/hw/net/vmxnet3.c
>> @@ -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 =
>> --
>> 2.5.5
>>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-08-09 3:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-08 12:38 [Qemu-devel] [PATCH] net: vmxnet3: check for device_active before write P J P
2016-08-08 13:08 ` Dmitry Fleytman
2016-08-09 3:39 ` Jason Wang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.