From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 107669E7 for ; Wed, 15 Feb 2017 07:25:16 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Feb 2017 22:25:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,164,1484035200"; d="scan'208";a="1094927679" Received: from yliu-dev.sh.intel.com ([10.239.67.162]) by orsmga001.jf.intel.com with ESMTP; 14 Feb 2017 22:25:15 -0800 From: Yuanhan Liu To: Yuanhan Liu Cc: Lei Yao , Maxime Coquelin , dpdk stable Date: Wed, 15 Feb 2017 14:26:49 +0800 Message-Id: <1487140012-13314-37-git-send-email-yuanhan.liu@linux.intel.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1487140012-13314-1-git-send-email-yuanhan.liu@linux.intel.com> References: <1487140012-13314-1-git-send-email-yuanhan.liu@linux.intel.com> Subject: [dpdk-stable] patch 'net/virtio: fix crash when number of virtio devices > 1' has been queued to stable release 16.11.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2017 06:25:17 -0000 Hi, FYI, your patch has been queued to stable release 16.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/18/17. So please shout if anyone has objections. Thanks. --yliu --- >>From 7c0ce1bc56d91301bc9fd58c8b022d0ade17f1ca Mon Sep 17 00:00:00 2001 From: Yuanhan Liu Date: Sun, 22 Jan 2017 16:47:00 +0800 Subject: [PATCH] net/virtio: fix crash when number of virtio devices > 1 [ backported from upstream commit 7687312571c90c3e5f93a4eb29c7a45c828d1f79 ] The vtpci_ops assignment needs the 'hw->port_id' as an input parameter. That said, we should set 'hw->port_id' firstly, then do the vtpci_ops assignment, while the code does reversely. That would result to a crash when more than one virtio devices are used, because we keep assigning proper vtpci_ops to virtio_hw_internal[0]->vtpci_ops, leaving the pointer for other ports being NULL. Reverse the order fixes this issue. Fixes: 9470427c88e1 ("net/virtio: do not store PCI device pointer at shared memory") Reported-by: Lei Yao Signed-off-by: Yuanhan Liu Reviewed-by: Maxime Coquelin --- drivers/net/virtio/virtio_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 4b6e0a1..f5961ab 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1380,6 +1380,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev) } pci_dev = eth_dev->pci_dev; + hw->port_id = eth_dev->data->port_id; if (pci_dev) { ret = vtpci_init(pci_dev, hw, &dev_flags); @@ -1387,7 +1388,6 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev) return ret; } - hw->port_id = eth_dev->data->port_id; eth_dev->data->dev_flags = dev_flags; /* reset device and negotiate default features */ -- 1.9.0