From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id AA9EC28F3; Thu, 24 May 2018 10:15:39 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 May 2018 01:15:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,436,1520924400"; d="scan'208";a="231240799" Received: from dpdk9.bj.intel.com ([172.16.182.183]) by fmsmga005.fm.intel.com with ESMTP; 24 May 2018 01:15:36 -0700 From: zhiyong.yang@intel.com To: dev@dpdk.org Cc: stable@dpdk.org, maxime.coquelin@redhat.com, tiwei.bie@intel.com, lei.a.yao@intel.com, ferruh.yigit@intel.com, Zhiyong Yang Date: Thu, 24 May 2018 23:51:01 +0800 Message-Id: <20180524155101.40911-1-zhiyong.yang@intel.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180524130423.15554-1-zhiyong.yang@intel.com> References: <20180524130423.15554-1-zhiyong.yang@intel.com> Subject: [dpdk-dev] [PATCH v2] net/virtio: fix add pointer checking for rxvq X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 May 2018 08:15:41 -0000 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 Cc: maxime.coquelin@redhat.com Cc: tiwei.bie@intel.com Cc: lei.a.yao@intel.com Cc: ferruh.yigit@intel.com Signed-off-by: Zhiyong Yang Reviewed-by: Maxime Coquelin --- Change in V2: change title prefix from net/virtio-user to net/virtio. 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 5833dad73..df50a571a 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.14.3