diff mbox series

[3/4] virtio-pmem: do delete rq_vq in virtio_pmem_unrealize

Message ID 20200225075554.10835-4-pannengyuan@huawei.com (mailing list archive)
State New, archived
Headers show
Series virtio: fix some virtio-queue leaks. | expand

Commit Message

Pan Nengyuan Feb. 25, 2020, 7:55 a.m. UTC
Similar to other virtio-deivces, rq_vq forgot to delete in virtio_pmem_unrealize, this patch fix it.
This device has aleardy maintained a vq pointer, thus we use the new virtio_delete_queue function directly to do the cleanup.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
---
 hw/virtio/virtio-pmem.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Philippe Mathieu-Daudé Feb. 25, 2020, 9:21 a.m. UTC | #1
On 2/25/20 8:55 AM, Pan Nengyuan wrote:
> Similar to other virtio-deivces, rq_vq forgot to delete in virtio_pmem_unrealize, this patch fix it.

"devices"

> This device has aleardy maintained a vq pointer, thus we use the new virtio_delete_queue function directly to do the cleanup.

"already"

> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>   hw/virtio/virtio-pmem.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/hw/virtio/virtio-pmem.c b/hw/virtio/virtio-pmem.c
> index 97287e923b..43399522f5 100644
> --- a/hw/virtio/virtio-pmem.c
> +++ b/hw/virtio/virtio-pmem.c
> @@ -130,6 +130,7 @@ static void virtio_pmem_unrealize(DeviceState *dev, Error **errp)
>       VirtIOPMEM *pmem = VIRTIO_PMEM(dev);
>   
>       host_memory_backend_set_mapped(pmem->memdev, false);
> +    virtio_delete_queue(pmem->rq_vq);
>       virtio_cleanup(vdev);
>   }
>   
>
diff mbox series

Patch

diff --git a/hw/virtio/virtio-pmem.c b/hw/virtio/virtio-pmem.c
index 97287e923b..43399522f5 100644
--- a/hw/virtio/virtio-pmem.c
+++ b/hw/virtio/virtio-pmem.c
@@ -130,6 +130,7 @@  static void virtio_pmem_unrealize(DeviceState *dev, Error **errp)
     VirtIOPMEM *pmem = VIRTIO_PMEM(dev);
 
     host_memory_backend_set_mapped(pmem->memdev, false);
+    virtio_delete_queue(pmem->rq_vq);
     virtio_cleanup(vdev);
 }