[dpdk-stable] patch 'net/virtio: fix crash when number of virtio devices > 1' has been queued to stable release 16.11.1
Yuanhan Liu
yuanhan.liu at linux.intel.com
Wed Feb 15 07:26:49 CET 2017
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 <yuanhan.liu at linux.intel.com>
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 <lei.a.yao at intel.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu at linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>
---
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
More information about the stable
mailing list