From patchwork Mon Apr 15 14:48:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Conole X-Patchwork-Id: 52796 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C01711B1FE; Mon, 15 Apr 2019 16:48:25 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 66BD91B163; Mon, 15 Apr 2019 16:48:23 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B8D9D3078AAD; Mon, 15 Apr 2019 14:48:22 +0000 (UTC) Received: from dhcp-25.97.bos.redhat.com (unknown [10.18.25.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id E1ED860C4C; Mon, 15 Apr 2019 14:48:19 +0000 (UTC) From: Aaron Conole To: dev@dpdk.org Cc: stable@dpdk.org, Maxime Coquelin , Tiwei Bie , Zhihong Wang , Pengzhen Liu Date: Mon, 15 Apr 2019 10:48:18 -0400 Message-Id: <20190415144818.26600-1-aconole@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 15 Apr 2019 14:48:22 +0000 (UTC) Subject: [dpdk-dev] [PATCH] net/virtio: fix dangling pointer on failure 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When eth_virtio_dev_init() is cleaning up, it does not correctly set the mac_addrs variable to NULL, which will lead to a double free. Found during unit-test fixes. Fixes: 43d18765c027 ("net/virtio: fix memory leak on failure") Cc: stable@dpdk.org Reported-by: Michael Santana Signed-off-by: Aaron Conole Reviewed-by: Tiwei Bie --- drivers/net/virtio/virtio_ethdev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 2272bb2e5..d25c08f0a 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1862,6 +1862,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev) out: rte_free(eth_dev->data->mac_addrs); + eth_dev->data->mac_addrs = NULL; return ret; }