From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
To: dev@dpdk.org
Cc: Yuanhan Liu <yuanhan.liu@linux.intel.com>, stable@dpdk.org
Subject: [dpdk-dev] [PATCH 3/3] net/virtio: fix crash when number of virtio devices > 1
Date: Sun, 22 Jan 2017 16:47:00 +0800 [thread overview]
Message-ID: <1485074820-8956-4-git-send-email-yuanhan.liu@linux.intel.com> (raw)
In-Reply-To: <1485074820-8956-1-git-send-email-yuanhan.liu@linux.intel.com>
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")
Cc: stable@dpdk.org
Reported-by: Lei Yao <lei.a.yao@intel.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.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 1d51942..68dde08 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1515,6 +1515,7 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev,
return -ENOMEM;
}
+ hw->port_id = eth_dev->data->port_id;
/* For virtio_user case the hw->virtio_user_dev is populated by
* virtio_user_eth_dev_alloc() before eth_virtio_dev_init() is called.
*/
@@ -1525,7 +1526,6 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev *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
next prev parent reply other threads:[~2017-01-22 8:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-22 8:46 [dpdk-dev] [PATCH 0/3] few virtio/vhost fixes Yuanhan Liu
2017-01-22 8:46 ` [dpdk-dev] [PATCH 1/3] vhost: fix dead loop in enqueue path Yuanhan Liu
2017-01-23 7:56 ` Maxime Coquelin
2017-01-22 8:46 ` [dpdk-dev] [PATCH 2/3] vhost: fix long stall of vhost-user negotiation Yuanhan Liu
2017-01-23 8:25 ` Maxime Coquelin
2017-01-22 8:47 ` Yuanhan Liu [this message]
2017-01-23 7:58 ` [dpdk-dev] [PATCH 3/3] net/virtio: fix crash when number of virtio devices > 1 Maxime Coquelin
2017-01-23 10:57 ` [dpdk-dev] [PATCH 0/3] few virtio/vhost fixes Yuanhan Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1485074820-8956-4-git-send-email-yuanhan.liu@linux.intel.com \
--to=yuanhan.liu@linux.intel.com \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).