Received: from eggs.gnu.org ([2001:4830:134:3::10]:42730) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWxth-0000lH-8R for qemu-devel@nongnu.org; Mon, 08 Aug 2016 23:40:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bWxte-0004VP-4A for qemu-devel@nongnu.org; Mon, 08 Aug 2016 23:40:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43512) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWxtd-0004V3-Tz for qemu-devel@nongnu.org; Mon, 08 Aug 2016 23:40:06 -0400 References: <1470659911-13733-1-git-send-email-ppandit@redhat.com> <58E21919-E8A6-4B24-8FD9-CB7972224481@daynix.com> From: Jason Wang Message-ID: <2d4a8d54-cd83-f558-6c36-4ddc41e745ed@redhat.com> Date: Tue, 9 Aug 2016 11:39:57 +0800 MIME-Version: 1.0 In-Reply-To: <58E21919-E8A6-4B24-8FD9-CB7972224481@daynix.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] net: vmxnet3: check for device_active before write List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Dmitry Fleytman , P J P Cc: Qemu Developers , Li Qiang On 2016=E5=B9=B408=E6=9C=8808=E6=97=A5 21:08, Dmitry Fleytman wrote: > Acked-by: Dmitry Fleytman > >> On 8 Aug 2016, at 15:38 PM, P J P wrote: >> >> From: Li Qiang >> >> 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 >> Signed-off-by: Prasad J Pandit >> --- >> 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 =3D opaque; >> >> + if (!s->device_active) { >> + return; >> + } >> + >> if (VMW_IS_MULTIREG_ADDR(addr, VMXNET3_REG_TXPROD, >> VMXNET3_DEVICE_MAX_TX_QUEUES, VMXNET3_REG_ALI= GN)) { >> int tx_queue_idx =3D >> --=20 >> 2.5.5 >> Applied, thanks.