* [PATCH] hw/virtio: vdpa: Fix leak of host-notifier memory-region
@ 2022-02-11 17:02 Laurent Vivier
2022-02-14 3:09 ` Jason Wang
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Laurent Vivier @ 2022-02-11 17:02 UTC (permalink / raw)
To: qemu-devel; +Cc: Laurent Vivier, Jason Wang, Cindy Lu, Michael S. Tsirkin
If call virtio_queue_set_host_notifier_mr fails, should free
host-notifier memory-region.
This problem can trigger a coredump with some vDPA drivers (mlx5,
but not with the vdpasim), if we unplug the virtio-net card from
the guest after a stop/start.
The same fix has been done for vhost-user:
1f89d3b91e3e ("hw/virtio: Fix leak of host-notifier memory-region")
Fixes: d0416d487bd5 ("vhost-vdpa: map virtqueue notification area if possible")
Cc: jasowang@redhat.com
Resolves: https://bugzilla.redhat.com/2027208
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
hw/virtio/vhost-vdpa.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index 04ea43704f5d..11f696468dc1 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -431,6 +431,7 @@ static int vhost_vdpa_host_notifier_init(struct vhost_dev *dev, int queue_index)
g_free(name);
if (virtio_queue_set_host_notifier_mr(vdev, queue_index, &n->mr, true)) {
+ object_unparent(OBJECT(&n->mr));
munmap(addr, page_size);
goto err;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] hw/virtio: vdpa: Fix leak of host-notifier memory-region
2022-02-11 17:02 [PATCH] hw/virtio: vdpa: Fix leak of host-notifier memory-region Laurent Vivier
@ 2022-02-14 3:09 ` Jason Wang
2022-02-16 8:33 ` Stefano Garzarella
2022-02-22 8:53 ` Laurent Vivier
2 siblings, 0 replies; 6+ messages in thread
From: Jason Wang @ 2022-02-14 3:09 UTC (permalink / raw)
To: Laurent Vivier; +Cc: qemu-devel, Cindy Lu, Michael S. Tsirkin
On Sat, Feb 12, 2022 at 1:03 AM Laurent Vivier <lvivier@redhat.com> wrote:
>
> If call virtio_queue_set_host_notifier_mr fails, should free
> host-notifier memory-region.
>
> This problem can trigger a coredump with some vDPA drivers (mlx5,
> but not with the vdpasim), if we unplug the virtio-net card from
> the guest after a stop/start.
>
> The same fix has been done for vhost-user:
> 1f89d3b91e3e ("hw/virtio: Fix leak of host-notifier memory-region")
>
> Fixes: d0416d487bd5 ("vhost-vdpa: map virtqueue notification area if possible")
> Cc: jasowang@redhat.com
> Resolves: https://bugzilla.redhat.com/2027208
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Cc: qemu-stable@nongnu.org
Acked-by: Jason Wang <jasowang@redhat.com>
> ---
> hw/virtio/vhost-vdpa.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
> index 04ea43704f5d..11f696468dc1 100644
> --- a/hw/virtio/vhost-vdpa.c
> +++ b/hw/virtio/vhost-vdpa.c
> @@ -431,6 +431,7 @@ static int vhost_vdpa_host_notifier_init(struct vhost_dev *dev, int queue_index)
> g_free(name);
>
> if (virtio_queue_set_host_notifier_mr(vdev, queue_index, &n->mr, true)) {
> + object_unparent(OBJECT(&n->mr));
> munmap(addr, page_size);
> goto err;
> }
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] hw/virtio: vdpa: Fix leak of host-notifier memory-region
2022-02-11 17:02 [PATCH] hw/virtio: vdpa: Fix leak of host-notifier memory-region Laurent Vivier
2022-02-14 3:09 ` Jason Wang
@ 2022-02-16 8:33 ` Stefano Garzarella
2022-02-22 8:53 ` Laurent Vivier
2 siblings, 0 replies; 6+ messages in thread
From: Stefano Garzarella @ 2022-02-16 8:33 UTC (permalink / raw)
To: Laurent Vivier; +Cc: Jason Wang, qemu-devel, Cindy Lu, Michael S. Tsirkin
On Fri, Feb 11, 2022 at 06:02:59PM +0100, Laurent Vivier wrote:
>If call virtio_queue_set_host_notifier_mr fails, should free
>host-notifier memory-region.
>
>This problem can trigger a coredump with some vDPA drivers (mlx5,
>but not with the vdpasim), if we unplug the virtio-net card from
>the guest after a stop/start.
>
>The same fix has been done for vhost-user:
> 1f89d3b91e3e ("hw/virtio: Fix leak of host-notifier memory-region")
>
>Fixes: d0416d487bd5 ("vhost-vdpa: map virtqueue notification area if possible")
>Cc: jasowang@redhat.com
>Resolves: https://bugzilla.redhat.com/2027208
>Signed-off-by: Laurent Vivier <lvivier@redhat.com>
>---
> hw/virtio/vhost-vdpa.c | 1 +
> 1 file changed, 1 insertion(+)
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
>
>diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
>index 04ea43704f5d..11f696468dc1 100644
>--- a/hw/virtio/vhost-vdpa.c
>+++ b/hw/virtio/vhost-vdpa.c
>@@ -431,6 +431,7 @@ static int vhost_vdpa_host_notifier_init(struct vhost_dev *dev, int queue_index)
> g_free(name);
>
> if (virtio_queue_set_host_notifier_mr(vdev, queue_index, &n->mr, true)) {
>+ object_unparent(OBJECT(&n->mr));
> munmap(addr, page_size);
> goto err;
> }
>--
>2.34.1
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] hw/virtio: vdpa: Fix leak of host-notifier memory-region
2022-02-11 17:02 [PATCH] hw/virtio: vdpa: Fix leak of host-notifier memory-region Laurent Vivier
2022-02-14 3:09 ` Jason Wang
2022-02-16 8:33 ` Stefano Garzarella
@ 2022-02-22 8:53 ` Laurent Vivier
2022-02-28 18:27 ` Laurent Vivier
2 siblings, 1 reply; 6+ messages in thread
From: Laurent Vivier @ 2022-02-22 8:53 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: Jason Wang, qemu-devel, Cindy Lu
Michael,
do you plan to merge this soon?
This is a bugfix for a QEMU coredump.
Thanks,
Laurent
On 11/02/2022 18:02, Laurent Vivier wrote:
> If call virtio_queue_set_host_notifier_mr fails, should free
> host-notifier memory-region.
>
> This problem can trigger a coredump with some vDPA drivers (mlx5,
> but not with the vdpasim), if we unplug the virtio-net card from
> the guest after a stop/start.
>
> The same fix has been done for vhost-user:
> 1f89d3b91e3e ("hw/virtio: Fix leak of host-notifier memory-region")
>
> Fixes: d0416d487bd5 ("vhost-vdpa: map virtqueue notification area if possible")
> Cc: jasowang@redhat.com
> Resolves: https://bugzilla.redhat.com/2027208
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
> hw/virtio/vhost-vdpa.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
> index 04ea43704f5d..11f696468dc1 100644
> --- a/hw/virtio/vhost-vdpa.c
> +++ b/hw/virtio/vhost-vdpa.c
> @@ -431,6 +431,7 @@ static int vhost_vdpa_host_notifier_init(struct vhost_dev *dev, int queue_index)
> g_free(name);
>
> if (virtio_queue_set_host_notifier_mr(vdev, queue_index, &n->mr, true)) {
> + object_unparent(OBJECT(&n->mr));
> munmap(addr, page_size);
> goto err;
> }
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] hw/virtio: vdpa: Fix leak of host-notifier memory-region
2022-02-22 8:53 ` Laurent Vivier
@ 2022-02-28 18:27 ` Laurent Vivier
2022-02-28 21:33 ` Michael S. Tsirkin
0 siblings, 1 reply; 6+ messages in thread
From: Laurent Vivier @ 2022-02-28 18:27 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: Jason Wang, qemu-devel, Cindy Lu
Ping?
Thanks,
Laurent
On 22/02/2022 09:53, Laurent Vivier wrote:
> Michael,
>
> do you plan to merge this soon?
>
> This is a bugfix for a QEMU coredump.
>
> Thanks,
> Laurent
>
> On 11/02/2022 18:02, Laurent Vivier wrote:
>> If call virtio_queue_set_host_notifier_mr fails, should free
>> host-notifier memory-region.
>>
>> This problem can trigger a coredump with some vDPA drivers (mlx5,
>> but not with the vdpasim), if we unplug the virtio-net card from
>> the guest after a stop/start.
>>
>> The same fix has been done for vhost-user:
>> 1f89d3b91e3e ("hw/virtio: Fix leak of host-notifier memory-region")
>>
>> Fixes: d0416d487bd5 ("vhost-vdpa: map virtqueue notification area if possible")
>> Cc: jasowang@redhat.com
>> Resolves: https://bugzilla.redhat.com/2027208
>> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
>> ---
>> hw/virtio/vhost-vdpa.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
>> index 04ea43704f5d..11f696468dc1 100644
>> --- a/hw/virtio/vhost-vdpa.c
>> +++ b/hw/virtio/vhost-vdpa.c
>> @@ -431,6 +431,7 @@ static int vhost_vdpa_host_notifier_init(struct vhost_dev *dev, int
>> queue_index)
>> g_free(name);
>> if (virtio_queue_set_host_notifier_mr(vdev, queue_index, &n->mr, true)) {
>> + object_unparent(OBJECT(&n->mr));
>> munmap(addr, page_size);
>> goto err;
>> }
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] hw/virtio: vdpa: Fix leak of host-notifier memory-region
2022-02-28 18:27 ` Laurent Vivier
@ 2022-02-28 21:33 ` Michael S. Tsirkin
0 siblings, 0 replies; 6+ messages in thread
From: Michael S. Tsirkin @ 2022-02-28 21:33 UTC (permalink / raw)
To: Laurent Vivier; +Cc: Jason Wang, qemu-devel, Cindy Lu
yes - in the next pull, thanks!
On Mon, Feb 28, 2022 at 07:27:34PM +0100, Laurent Vivier wrote:
> Ping?
>
> Thanks,
> Laurent
>
> On 22/02/2022 09:53, Laurent Vivier wrote:
> > Michael,
> >
> > do you plan to merge this soon?
> >
> > This is a bugfix for a QEMU coredump.
> >
> > Thanks,
> > Laurent
> >
> > On 11/02/2022 18:02, Laurent Vivier wrote:
> > > If call virtio_queue_set_host_notifier_mr fails, should free
> > > host-notifier memory-region.
> > >
> > > This problem can trigger a coredump with some vDPA drivers (mlx5,
> > > but not with the vdpasim), if we unplug the virtio-net card from
> > > the guest after a stop/start.
> > >
> > > The same fix has been done for vhost-user:
> > > 1f89d3b91e3e ("hw/virtio: Fix leak of host-notifier memory-region")
> > >
> > > Fixes: d0416d487bd5 ("vhost-vdpa: map virtqueue notification area if possible")
> > > Cc: jasowang@redhat.com
> > > Resolves: https://bugzilla.redhat.com/2027208
> > > Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> > > ---
> > > hw/virtio/vhost-vdpa.c | 1 +
> > > 1 file changed, 1 insertion(+)
> > >
> > > diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
> > > index 04ea43704f5d..11f696468dc1 100644
> > > --- a/hw/virtio/vhost-vdpa.c
> > > +++ b/hw/virtio/vhost-vdpa.c
> > > @@ -431,6 +431,7 @@ static int vhost_vdpa_host_notifier_init(struct
> > > vhost_dev *dev, int queue_index)
> > > g_free(name);
> > > if (virtio_queue_set_host_notifier_mr(vdev, queue_index, &n->mr, true)) {
> > > + object_unparent(OBJECT(&n->mr));
> > > munmap(addr, page_size);
> > > goto err;
> > > }
> >
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-02-28 21:34 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-11 17:02 [PATCH] hw/virtio: vdpa: Fix leak of host-notifier memory-region Laurent Vivier
2022-02-14 3:09 ` Jason Wang
2022-02-16 8:33 ` Stefano Garzarella
2022-02-22 8:53 ` Laurent Vivier
2022-02-28 18:27 ` Laurent Vivier
2022-02-28 21:33 ` Michael S. Tsirkin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).