From: zhiyong.yang@intel.com
To: dev@dpdk.org
Cc: jianfeng.tan@intel.com, zhihong.wang@intel.com,
maxime.coquelin@redhat.com, thomas@monjalon.net,
dong1.wang@intel.com, tiwei.bie@intel.com, stable@dpdk.org,
Zhiyong Yang <zhiyong.yang@intel.com>
Subject: [dpdk-stable] [PATCH v3 1/4] net/virtio: fix add pointer checking
Date: Wed, 21 Mar 2018 11:03:40 +0800 [thread overview]
Message-ID: <20180321030343.64399-2-zhiyong.yang@intel.com> (raw)
In-Reply-To: <20180321030343.64399-1-zhiyong.yang@intel.com>
It is necessary to add pointer checking because in some case the
code will cause crash. For example, the code goes here before
memory allocation of rxvq is finished.
Fixes: 7365504f77e3("net/virtio: support guest announce")
Cc: stable@dpdk.org
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
---
drivers/net/virtio/virtio_ethdev.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 884f74ad0..f377d8aa3 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1273,9 +1273,13 @@ static void
virtio_notify_peers(struct rte_eth_dev *dev)
{
struct virtio_hw *hw = dev->data->dev_private;
- struct virtnet_rx *rxvq = dev->data->rx_queues[0];
+ struct virtnet_rx *rxvq;
struct rte_mbuf *rarp_mbuf;
+ if (!dev->data->rx_queues)
+ return;
+
+ rxvq = dev->data->rx_queues[0];
rarp_mbuf = rte_net_make_rarp_packet(rxvq->mpool,
(struct ether_addr *)hw->mac_addr);
if (rarp_mbuf == NULL) {
--
2.14.3
next parent reply other threads:[~2018-03-21 3:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20180214145330.4679-1-zhiyong.yang@intel.com>
[not found] ` <20180321030343.64399-1-zhiyong.yang@intel.com>
2018-03-21 3:03 ` zhiyong.yang [this message]
2018-03-28 7:26 ` Tan, Jianfeng
2018-03-28 7:48 ` Yang, Zhiyong
2018-03-29 11:59 ` Maxime Coquelin
2018-03-29 12:01 ` Maxime Coquelin
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=20180321030343.64399-2-zhiyong.yang@intel.com \
--to=zhiyong.yang@intel.com \
--cc=dev@dpdk.org \
--cc=dong1.wang@intel.com \
--cc=jianfeng.tan@intel.com \
--cc=maxime.coquelin@redhat.com \
--cc=stable@dpdk.org \
--cc=thomas@monjalon.net \
--cc=tiwei.bie@intel.com \
--cc=zhihong.wang@intel.com \
/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).