From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from alln-iport-4.cisco.com (alln-iport-4.cisco.com [173.37.142.91]) by dpdk.org (Postfix) with ESMTP id 215AD25B3 for ; Sat, 3 Feb 2018 15:55:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=854; q=dns/txt; s=iport; t=1517669728; x=1518879328; h=from:to:cc:subject:date:message-id; bh=1TgJGh3iVgKCwuC+brsuMXwLviEOIK723Dt8zXc713w=; b=GRyjVmXMExsxbybyJvZ2RFE9yrMb4ZkUx19byzt3o3aTtKJhQyDxcVWH MTbhbmwplbYY12dndj9KbQ7lOOGnWEzU4cMzb56iIlCL158ipxOhTFXra MSfIX6Oqektg8sYbSvXcRvmDxyZ4klbirxcg6ehy+D0G7JRANoCYTRTXX I=; X-IronPort-AV: E=Sophos;i="5.46,455,1511827200"; d="scan'208";a="65812582" Received: from rcdn-core-11.cisco.com ([173.37.93.147]) by alln-iport-4.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Feb 2018 14:55:27 +0000 Received: from cpp-rtpbld-31.cisco.com (cpp-rtpbld-31.cisco.com [172.18.5.114]) by rcdn-core-11.cisco.com (8.14.5/8.14.5) with ESMTP id w13EtQAm008361; Sat, 3 Feb 2018 14:55:26 GMT Received: by cpp-rtpbld-31.cisco.com (Postfix, from userid 140087) id A78EA760; Sat, 3 Feb 2018 09:55:26 -0500 (EST) From: David C Harton To: yliu@fridaylinux.org, maxime.coquelin@redhat.com, tiwei.bie@intel.com Cc: dev@dpdk.org, David C Harton , olivier.matz@6wind.com Date: Sat, 3 Feb 2018 09:55:23 -0500 Message-Id: <20180203145523.28013-1-dharton@cisco.com> X-Mailer: git-send-email 2.10.3.dirty Subject: [dpdk-dev] [PATCH] net/virtio: Fix crash in virtio_dev_free_mbufs 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: Sat, 03 Feb 2018 14:55:28 -0000 virtio_dev_free_mbufs was recently modified to free the virtqueues but failed to check whether the array was allocated. Added a check to ensure vqs was non-null. Fixes: bdb32afbb610 ("net/virtio: rationalize queue flushing") Cc: olivier.matz@6wind.com Signed-off-by: David C Harton --- 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 2082d6a..884f74a 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1975,6 +1975,9 @@ static void virtio_dev_free_mbufs(struct rte_eth_dev *dev) struct rte_mbuf *buf; int queue_type; + if (hw->vqs == NULL) + return; + for (i = 0; i < nr_vq; i++) { vq = hw->vqs[i]; if (!vq) -- 2.10.3.dirty