From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <maxime.coquelin@redhat.com>
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28])
 by dpdk.org (Postfix) with ESMTP id 688081B30B
 for <dev@dpdk.org>; Mon,  5 Feb 2018 09:44:59 +0100 (CET)
Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com
 [10.5.11.11])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mx1.redhat.com (Postfix) with ESMTPS id BF7A7C036740;
 Mon,  5 Feb 2018 08:44:58 +0000 (UTC)
Received: from [10.36.112.45] (ovpn-112-45.ams2.redhat.com [10.36.112.45])
 by smtp.corp.redhat.com (Postfix) with ESMTPS id 2E7F0620D8;
 Mon,  5 Feb 2018 08:44:56 +0000 (UTC)
To: David C Harton <dharton@cisco.com>, yliu@fridaylinux.org,
 tiwei.bie@intel.com
Cc: dev@dpdk.org, olivier.matz@6wind.com
References: <20180203145523.28013-1-dharton@cisco.com>
From: Maxime Coquelin <maxime.coquelin@redhat.com>
Message-ID: <aaaeb438-3a08-a7f2-e5f3-0a1699a23a3e@redhat.com>
Date: Mon, 5 Feb 2018 09:44:54 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.5.2
MIME-Version: 1.0
In-Reply-To: <20180203145523.28013-1-dharton@cisco.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
 (mx1.redhat.com [10.5.110.31]); Mon, 05 Feb 2018 08:44:58 +0000 (UTC)
Subject: Re: [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 <dev.dpdk.org>
List-Unsubscribe: <https://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 05 Feb 2018 08:44:59 -0000



On 02/03/2018 03:55 PM, David C Harton wrote:
> 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 <dharton@cisco.com>
> ---
>   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)
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime