diff mbox

[v4,08/10] vmxnet3: fix reference leak issue

Message ID 1476859665-30133-9-git-send-email-caoj.fnst@cn.fujitsu.com
State New
Headers show

Commit Message

Cao jin Oct. 19, 2016, 6:47 a.m. UTC
On migration target, msix_vector_use() will be called in vmxnet3_post_load()
in second time, without a matching second call to msi_vector_unuse(),
which results in vector reference leak.

CC: Dmitry Fleytman <dmitry@daynix.com>
CC: Jason Wang <jasowang@redhat.com>
CC: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
---
 hw/net/vmxnet3.c | 10 ----------
 1 file changed, 10 deletions(-)

Comments

Dmitry Fleytman Oct. 19, 2016, 6:51 a.m. UTC | #1
Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>

> On 19 Oct 2016, at 09:47 AM, Cao jin <caoj.fnst@cn.fujitsu.com> wrote:
> 
> On migration target, msix_vector_use() will be called in vmxnet3_post_load()
> in second time, without a matching second call to msi_vector_unuse(),
> which results in vector reference leak.
> 
> CC: Dmitry Fleytman <dmitry@daynix.com>
> CC: Jason Wang <jasowang@redhat.com>
> CC: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
> ---
> hw/net/vmxnet3.c | 10 ----------
> 1 file changed, 10 deletions(-)
> 
> diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
> index 7d44af1..a9854e4 100644
> --- a/hw/net/vmxnet3.c
> +++ b/hw/net/vmxnet3.c
> @@ -2551,21 +2551,11 @@ static void vmxnet3_put_rxq_descr(QEMUFile *f, void *pv, size_t size)
> static int vmxnet3_post_load(void *opaque, int version_id)
> {
>     VMXNET3State *s = opaque;
> -    PCIDevice *d = PCI_DEVICE(s);
> 
>     net_tx_pkt_init(&s->tx_pkt, PCI_DEVICE(s),
>                     s->max_tx_frags, s->peer_has_vhdr);
>     net_rx_pkt_init(&s->rx_pkt, s->peer_has_vhdr);
> 
> -    if (s->msix_used) {
> -        if  (!vmxnet3_use_msix_vectors(s, VMXNET3_MAX_INTRS)) {
> -            VMW_WRPRN("Failed to re-use MSI-X vectors");
> -            msix_uninit(d, &s->msix_bar, &s->msix_bar);
> -            s->msix_used = false;
> -            return -1;
> -        }
> -    }
> -
>     vmxnet3_validate_queues(s);
>     vmxnet3_validate_interrupts(s);
> 
> -- 
> 2.1.0
> 
> 
>
diff mbox

Patch

diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
index 7d44af1..a9854e4 100644
--- a/hw/net/vmxnet3.c
+++ b/hw/net/vmxnet3.c
@@ -2551,21 +2551,11 @@  static void vmxnet3_put_rxq_descr(QEMUFile *f, void *pv, size_t size)
 static int vmxnet3_post_load(void *opaque, int version_id)
 {
     VMXNET3State *s = opaque;
-    PCIDevice *d = PCI_DEVICE(s);
 
     net_tx_pkt_init(&s->tx_pkt, PCI_DEVICE(s),
                     s->max_tx_frags, s->peer_has_vhdr);
     net_rx_pkt_init(&s->rx_pkt, s->peer_has_vhdr);
 
-    if (s->msix_used) {
-        if  (!vmxnet3_use_msix_vectors(s, VMXNET3_MAX_INTRS)) {
-            VMW_WRPRN("Failed to re-use MSI-X vectors");
-            msix_uninit(d, &s->msix_bar, &s->msix_bar);
-            s->msix_used = false;
-            return -1;
-        }
-    }
-
     vmxnet3_validate_queues(s);
     vmxnet3_validate_interrupts(s);