From patchwork Tue Jan 23 09:47:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianfeng Tan X-Patchwork-Id: 34305 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 077951B017; Tue, 23 Jan 2018 10:45:37 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 8596A1B015 for ; Tue, 23 Jan 2018 10:45:35 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Jan 2018 01:45:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,400,1511856000"; d="scan'208";a="12333710" Received: from dpdk06.sh.intel.com ([10.67.110.196]) by orsmga008.jf.intel.com with ESMTP; 23 Jan 2018 01:45:32 -0800 From: Jianfeng Tan To: dev@dpdk.org Cc: yuanhan.liu@linux.intel.com, maxime.coquelin@redhat.com, Jianfeng Tan Date: Tue, 23 Jan 2018 09:47:23 +0000 Message-Id: <1516700843-131786-1-git-send-email-jianfeng.tan@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] net/virtio-user: fix segfault as features change X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Since commit 59fe5e17d93 ("vhost: propagate set features handling error"), vhost does not allow to set different features without reset. The virito-user driver fails to reset the device in below commit. To fix, we send the reset message as stopping the device. Fixes: c12a26ee209e ("net/virtio-user: fix not properly reset device") Reported-by: Lei Yao Reported-by: Tiwei Bie Signed-off-by: Jianfeng Tan --- drivers/net/virtio/virtio_user/virtio_user_dev.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index 7a70c18..3b5f737 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -142,6 +142,11 @@ int virtio_user_stop_device(struct virtio_user_dev *dev) for (i = 0; i < dev->max_queue_pairs; ++i) dev->ops->enable_qp(dev, i, 0); + if (dev->ops->send_request(dev, VHOST_USER_RESET_OWNER, NULL) < 0) { + PMD_DRV_LOG(INFO, "Failed to reset the device\n"); + return -1; + } + return 0; }