From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 96B7558F3 for ; Tue, 20 Oct 2015 17:37:50 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 20 Oct 2015 08:37:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,707,1437462000"; d="scan'208";a="831331221" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 20 Oct 2015 08:37:49 -0700 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t9KFblml025793; Tue, 20 Oct 2015 16:37:47 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id t9KFblpw016618; Tue, 20 Oct 2015 16:37:47 +0100 Received: (from bairemon@localhost) by sivswdev01.ir.intel.com with id t9KFblfM016614; Tue, 20 Oct 2015 16:37:47 +0100 From: Bernard Iremonger To: dev@dpdk.org Date: Tue, 20 Oct 2015 16:37:41 +0100 Message-Id: <1445355462-16521-1-git-send-email-bernard.iremonger@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: References: Subject: [dpdk-dev] [PATCH 1/2] virtio: fixed segmentation fault in queue_release 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: , X-List-Received-Date: Tue, 20 Oct 2015 15:37:51 -0000 if input parameter vq is NULL, hw = vq->hw, causes a segmentation fault. Signed-off-by: Bernard Iremonger --- drivers/net/virtio/virtio_ethdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 465d3cd..147aca1 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -239,9 +239,10 @@ virtio_set_multiple_queues(struct rte_eth_dev *dev, uint16_t nb_queues) void virtio_dev_queue_release(struct virtqueue *vq) { - struct virtio_hw *hw = vq->hw; + struct virtio_hw *hw; if (vq) { + hw = vq->hw; /* Select and deactivate the queue */ VIRTIO_WRITE_REG_2(hw, VIRTIO_PCI_QUEUE_SEL, vq->queue_id); VIRTIO_WRITE_REG_4(hw, VIRTIO_PCI_QUEUE_PFN, 0); -- 1.9.1