* [PATCH] lib/librte_vhost: remove vhost device from data plane when receive VHOST_SET_MEM_TABLE message
@ 2015-03-03 2:26 Huawei Xie
[not found] ` <1425349564-30489-1-git-send-email-huawei.xie-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Huawei Xie @ 2015-03-03 2:26 UTC (permalink / raw)
To: dev-VfR2kkLFssw
This patch fixes the segfault issue in the case vhost receives new VHOST_SET_MEM_TABLE message without VHOST_VRING_GET_VRING_BASE(which we uses as the stop message).
Signed-off-by: Huawei Xie <huawei.xie-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
lib/librte_vhost/vhost_user/virtio-net-user.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/librte_vhost/vhost_user/virtio-net-user.c b/lib/librte_vhost/vhost_user/virtio-net-user.c
index 97c5177..aa08706 100644
--- a/lib/librte_vhost/vhost_user/virtio-net-user.c
+++ b/lib/librte_vhost/vhost_user/virtio-net-user.c
@@ -109,6 +109,10 @@ user_set_mem_table(struct vhost_device_ctx ctx, struct VhostUserMsg *pmsg)
if (dev == NULL)
return -1;
+ /* Remove from the data plane. */
+ if (dev->flags & VIRTIO_DEV_RUNNING)
+ notify_ops->destroy_device(dev);
+
if (dev->mem) {
free_mem_region(dev);
free(dev->mem);
--
1.8.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] lib/librte_vhost: remove vhost device from data plane when receive VHOST_SET_MEM_TABLE message
[not found] ` <1425349564-30489-1-git-send-email-huawei.xie-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2015-03-04 11:57 ` Long, Thomas
[not found] ` <EDCDDC5F3D468742B7A0048DF68542612FE3F306-kPTMFJFq+rGvNW/NfzhIbrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Long, Thomas @ 2015-03-04 11:57 UTC (permalink / raw)
To: Xie, Huawei, dev-VfR2kkLFssw@public.gmane.org
Acked-by: Tommy Long <thomas.long-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
-----Original Message-----
From: Xie, Huawei
Sent: Tuesday, March 3, 2015 2:26 AM
To: dev-VfR2kkLFssw@public.gmane.org
Cc: haifeng.lin-hv44wF8Li93QT0dZR+AlfA@public.gmane.org; mukawa-AlSX/UN32fvPDbFq/vQRIQ@public.gmane.org; Long, Thomas; Xie, Huawei
Subject: [PATCH] lib/librte_vhost: remove vhost device from data plane when receive VHOST_SET_MEM_TABLE message
This patch fixes the segfault issue in the case vhost receives new VHOST_SET_MEM_TABLE message without VHOST_VRING_GET_VRING_BASE(which we uses as the stop message).
Signed-off-by: Huawei Xie <huawei.xie-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
lib/librte_vhost/vhost_user/virtio-net-user.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/librte_vhost/vhost_user/virtio-net-user.c b/lib/librte_vhost/vhost_user/virtio-net-user.c
index 97c5177..aa08706 100644
--- a/lib/librte_vhost/vhost_user/virtio-net-user.c
+++ b/lib/librte_vhost/vhost_user/virtio-net-user.c
@@ -109,6 +109,10 @@ user_set_mem_table(struct vhost_device_ctx ctx, struct VhostUserMsg *pmsg)
if (dev == NULL)
return -1;
+ /* Remove from the data plane. */
+ if (dev->flags & VIRTIO_DEV_RUNNING)
+ notify_ops->destroy_device(dev);
+
if (dev->mem) {
free_mem_region(dev);
free(dev->mem);
--
1.8.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] lib/librte_vhost: remove vhost device from data plane when receive VHOST_SET_MEM_TABLE message
[not found] ` <EDCDDC5F3D468742B7A0048DF68542612FE3F306-kPTMFJFq+rGvNW/NfzhIbrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2015-03-05 21:08 ` Thomas Monjalon
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2015-03-05 21:08 UTC (permalink / raw)
To: Xie, Huawei; +Cc: dev-VfR2kkLFssw
> > This patch fixes the segfault issue in the case vhost receives new
> > VHOST_SET_MEM_TABLE message without VHOST_VRING_GET_VRING_BASE(which
> > we uses as the stop message).
> >
> > Signed-off-by: Huawei Xie <huawei.xie-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
>
> Acked-by: Tommy Long <thomas.long-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Applied, thanks
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-05 21:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-03 2:26 [PATCH] lib/librte_vhost: remove vhost device from data plane when receive VHOST_SET_MEM_TABLE message Huawei Xie
[not found] ` <1425349564-30489-1-git-send-email-huawei.xie-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-03-04 11:57 ` Long, Thomas
[not found] ` <EDCDDC5F3D468742B7A0048DF68542612FE3F306-kPTMFJFq+rGvNW/NfzhIbrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-03-05 21:08 ` Thomas Monjalon
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).