patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH v2 1/5] net/virtio: fix add pointer checking
       [not found] ` <20180315094514.50417-1-zhiyong.yang@intel.com>
@ 2018-03-15  9:45   ` zhiyong.yang
  0 siblings, 0 replies; only message in thread
From: zhiyong.yang @ 2018-03-15  9:45 UTC (permalink / raw)
  To: dev
  Cc: maxime.coquelin, jianfeng.tan, dong1.wang, zhihong.wang, thomas,
	stable, Zhiyong Yang

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 done.

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 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 884f74ad0..b38582c8d 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1273,9 +1273,14 @@ 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-03-15  9:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20180214145330.4679-2-zhiyong.yang@intel.com>
     [not found] ` <20180315094514.50417-1-zhiyong.yang@intel.com>
2018-03-15  9:45   ` [dpdk-stable] [PATCH v2 1/5] net/virtio: fix add pointer checking zhiyong.yang

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).