From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id E8C69677E for ; Tue, 14 Jun 2016 08:48:11 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 13 Jun 2016 23:48:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,470,1459839600"; d="scan'208";a="1001436351" Received: from dpdk15.sh.intel.com ([10.239.129.25]) by fmsmga002.fm.intel.com with ESMTP; 13 Jun 2016 23:48:10 -0700 From: Huawei Xie To: dev@dpdk.org Cc: vincent.mc.li@gmail.com, yuanhan.liu@intel.com, thomas.monjalon@6wind.com, Huawei Xie Date: Mon, 13 Jun 2016 22:53:08 +0800 Message-Id: <1465829588-118146-1-git-send-email-huawei.xie@intel.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1464100542-48126-1-git-send-email-huawei.xie@intel.com> References: <1464100542-48126-1-git-send-email-huawei.xie@intel.com> Subject: [dpdk-dev] [PATCH v2] virtio: fix crash loading virtio driver when devargs isn't specified X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jun 2016 06:48:12 -0000 We skip kernel managed virtio devices, if it isn't whitelisted. Before checking if the virtio device is whitelisted, check if devargs is specified. Fixes: ac5e1d838dc1 ("virtio: skip error when probing kernel managed device") Signed-off-by: Huawei Xie Reported-by: Vincent Li --- v2: - add reported-by - reword subject - reword commit message --- drivers/net/virtio/virtio_pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c index d0f2428..60ec4da 100644 --- a/drivers/net/virtio/virtio_pci.c +++ b/drivers/net/virtio/virtio_pci.c @@ -626,6 +626,7 @@ next: * Return -1: * if there is error mapping with VFIO/UIO. * if port map error when driver type is KDRV_NONE. + * if whitelisted but driver type is KDRV_UNKNOWN. * Return 1 if kernel driver is managing the device. * Return 0 on success. */ @@ -651,7 +652,8 @@ vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw, PMD_INIT_LOG(INFO, "trying with legacy virtio pci."); if (legacy_virtio_resource_init(dev, hw, dev_flags) < 0) { if (dev->kdrv == RTE_KDRV_UNKNOWN && - dev->devargs->type != RTE_DEVTYPE_WHITELISTED_PCI) { + (!dev->devargs || + dev->devargs->type != RTE_DEVTYPE_WHITELISTED_PCI)) { PMD_INIT_LOG(INFO, "skip kernel managed virtio device."); return 1; -- 1.8.1.4