From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: [PATCH] vchost: Notify application of ownership change Date: Fri, 7 Aug 2015 19:20:33 +0200 Message-ID: <55C4E8E1.9090406@siemens.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit To: dev@dpdk.org Return-path: Received: from thoth.sbs.de (thoth.sbs.de [192.35.17.2]) by dpdk.org (Postfix) with ESMTP id DFF4D5682 for ; Fri, 7 Aug 2015 19:20:36 +0200 (CEST) List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On VHOST_*_RESET_OWNER, we reinitialize the device but without telling the application. That will cause crashes when it continues to invoke vhost services on the device. Fix it by calling the destruction hook if the device is still in use. Signed-off-by: Jan Kiszka --- This is the surprisingly simple answer to my questions in http://thread.gmane.org/gmane.comp.networking.dpdk.devel/22661. lib/librte_vhost/virtio-net.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c index b520ec5..3c5b5b2 100644 --- a/lib/librte_vhost/virtio-net.c +++ b/lib/librte_vhost/virtio-net.c @@ -402,6 +402,9 @@ reset_owner(struct vhost_device_ctx ctx) ll_dev = get_config_ll_entry(ctx); + if ((ll_dev->dev.flags & VIRTIO_DEV_RUNNING)) + notify_ops->destroy_device(&ll_dev->dev); + cleanup_device(&ll_dev->dev); init_device(&ll_dev->dev); -- 2.1.4