From patchwork Tue Aug 3 23:45:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gaoxiang Liu X-Patchwork-Id: 96643 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2200BA0C45; Wed, 4 Aug 2021 01:45:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9DA8640696; Wed, 4 Aug 2021 01:45:38 +0200 (CEST) Received: from m12-14.163.com (m12-14.163.com [220.181.12.14]) by mails.dpdk.org (Postfix) with ESMTP id 42DC34014F; Wed, 4 Aug 2021 01:45:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=Q5TOJ Eszi4B0F+PS+m2HvITB91uZuwZ2gcTYqQu5jmM=; b=G2CPQqurNN0zqN9EtTIX0 LgawTEj138Ji1Yvxif+cGWuFP7U0N8Py2jM2/qA8bcNBhyHrVAj0JEfZptMj/CEk n2OLDzFZteos6lhklPVbF3XXqeK/eyIfLpwOH/GvG69rdw+k2x4xcEV0fbXPyvz3 B5+HyH8pc+I7GnE0d6WOfs= Received: from DESKTOP-ONA2IA7.localdomain (unknown [39.182.55.95]) by smtp10 (Coremail) with SMTP id DsCowACHEPAR1QlhxMpgAA--.15827S4; Wed, 04 Aug 2021 07:45:26 +0800 (CST) From: Gaoxiang Liu To: dev@dpdk.org, Maxime Coquelin , Chenbo Xia Cc: liugaoxiang@huawei.com, Gaoxiang Liu , stable@dpdk.org Date: Wed, 4 Aug 2021 07:45:15 +0800 Message-Id: <20210803234516.859-1-gaoxiangliu0@163.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210803233040.492-1-gaoxiangliu0@163.com> References: <20210803233040.492-1-gaoxiangliu0@163.com> MIME-Version: 1.0 X-CM-TRANSID: DsCowACHEPAR1QlhxMpgAA--.15827S4 X-Coremail-Antispam: 1Uf129KBjvdXoWrKr13KFWrJFy3Xw13GFW5GFg_yoWfWrX_GF 17JF9rAF4UC3Wq93y7AF1rZrWSk3Z5WF4kWa9Iq34rX3WUG3W5XrnIvrnxGanrWw4jkrZr Grs3Gwn8u34S9jkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUnMq2tUUUUU== X-Originating-IP: [39.182.55.95] X-CM-SenderInfo: xjdr5xxdqjzxjxq6il2tof0z/1tbiMhfjOlWBu4cAOwAAsv Subject: [dpdk-dev] [PATCH v2] net/virtio: fix repeated memory free of vq X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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 virtio_init_queue returns error, the memory of vq is freed. But the value of hw->vqs[queue_idx] does not restore. If hw->vqs[queue_idx] != NULL, the memory of vq is freed again in virtio_free_queues. Fixes: 69c80d4ef89b ("net/virtio: allocate queue at init stage") Cc: stable@dpdk.org Signed-off-by: Gaoxiang Liu v2: fix spelling warning Signed-off-by: Gaoxiang Liu --- 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 056830566..fc72d71cb 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -631,6 +631,7 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t queue_idx) rte_memzone_free(mz); free_vq: rte_free(vq); + hw->vqs[queue_idx] = NULL; return ret; }