From f42deafa44524562efa3f0373bf27f6adef382f5 Mon Sep 17 00:00:00 2001 From: Zhiyong Yang Date: Thu, 24 May 2018 23:51:01 +0800 Subject: [PATCH] net/virtio-user: fix crash in server mode For virtio-user server mode, one use case comes across segmentation fault. step 1: Launch vhost side as client firstly. step 2: launch virtio-user side as server. The cause is: after registering virtio_interrupt_handler into eal-intr-thread, two threads (main thread and eal-intr-thread) have sync issues, so add rxvq pointer checking in function virtio_notify_peers to decide if the code can continue. Fixes: bd8f50a45d0f ("net/virtio-user: support server mode") Cc: stable@dpdk.org Signed-off-by: Zhiyong Yang Reviewed-by: Maxime Coquelin --- drivers/net/virtio/virtio_ethdev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 5833dad737..df50a571a7 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1245,6 +1245,9 @@ virtio_notify_peers(struct rte_eth_dev *dev) return; rxvq = dev->data->rx_queues[0]; + if (!rxvq) + return; + rarp_mbuf = rte_net_make_rarp_packet(rxvq->mpool, (struct ether_addr *)hw->mac_addr); if (rarp_mbuf == NULL) { -- 2.20.1