From patchwork Thu Sep 11 22:25:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Damjan Marion (damarion)" X-Patchwork-Id: 361 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 82AAF68AC; Fri, 12 Sep 2014 00:19:57 +0200 (CEST) Received: from alln-iport-4.cisco.com (alln-iport-4.cisco.com [173.37.142.91]) by dpdk.org (Postfix) with ESMTP id 745BE58E0 for ; Fri, 12 Sep 2014 00:19:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=861; q=dns/txt; s=iport; t=1410474312; x=1411683912; h=from:to:cc:subject:date:message-id; bh=Ebxh9zihW/L/elzvVWQeCSZQ28i927SMZZlhFT5BRcY=; b=kuz7tYli8/P5Ce8U9FntzuSBo4xkCselE4ws+aX5wlKCQLL4ZflpmKg7 a7cFfybDcdBuHNrZEokwwOxjEuWwJ4AMniGA3Te37fVa0mNCCzvCEhko0 S6SUZpub93kWGfQUgYkL4VFVnhHDht8rlZLOnJmepNWmSWtsgUR2W7Lky g=; X-IronPort-AV: E=Sophos;i="5.04,508,1406592000"; d="scan'208";a="77179218" Received: from alln-core-11.cisco.com ([173.36.13.133]) by alln-iport-4.cisco.com with ESMTP; 11 Sep 2014 22:25:11 +0000 Received: from localhost.localdomain (ts1-host1.cisco.com [172.21.174.32]) by alln-core-11.cisco.com (8.14.5/8.14.5) with ESMTP id s8BMPAbL000662; Thu, 11 Sep 2014 22:25:10 GMT From: damarion@cisco.com To: dev@dpdk.org Date: Thu, 11 Sep 2014 15:25:08 -0700 Message-Id: <1410474308-17744-1-git-send-email-damarion@cisco.com> X-Mailer: git-send-email 1.9.1 Subject: [dpdk-dev] [PATCH] virtio: fix crash if VIRTIO_NET_F_CTRL_VQ is not negotiated X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Damjan Marion If VIRTIO_NET_F_CTRL_VQ is not negotiated hw->cvq will be NULL Signed-off-by: Damjan Marion Acked-by: Changchun Ouyang Acked-by: Olivier Matz --- lib/librte_pmd_virtio/virtio_rxtx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/librte_pmd_virtio/virtio_rxtx.c b/lib/librte_pmd_virtio/virtio_rxtx.c index 0b10108..8cb635e 100644 --- a/lib/librte_pmd_virtio/virtio_rxtx.c +++ b/lib/librte_pmd_virtio/virtio_rxtx.c @@ -328,8 +328,10 @@ virtio_dev_cq_start(struct rte_eth_dev *dev) struct virtio_hw *hw = VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private); - virtio_dev_vring_start(hw->cvq, VTNET_CQ); - VIRTQUEUE_DUMP((struct virtqueue *)hw->cvq); + if (hw->cvq) { + virtio_dev_vring_start(hw->cvq, VTNET_CQ); + VIRTQUEUE_DUMP((struct virtqueue *)hw->cvq); + } } void