From patchwork Fri Jul 30 14:41:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gaoxiang Liu X-Patchwork-Id: 96468 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 38E51A0C40; Fri, 30 Jul 2021 16:42:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E886E40040; Fri, 30 Jul 2021 16:42:17 +0200 (CEST) Received: from m12-18.163.com (m12-18.163.com [220.181.12.18]) by mails.dpdk.org (Postfix) with ESMTP id 0A62C4003F; Fri, 30 Jul 2021 16:42:15 +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=S8HIJ jyHyRro/tZdA79ZXTMXnSoueoZ+qmSCv2NP/jE=; b=CIqRjPRQ4EKqCHg2PdQ4t EWGodIT2/6ELGA93iy9Nqoj8BpNoaYskWX8CgZefjVmnK8AL/Ax4TieOv+V0/Tmt 32agAcFn7WMWIJr1ECOccXtIIt0tT5rGKH8gd7cCojaCS+8TYCCjGTG5VMkKpZgU uJVi5kBx7imG9MU+I3l42s= Received: from DESKTOP-ONA2IA7.localdomain (unknown [39.182.55.95]) by smtp14 (Coremail) with SMTP id EsCowAD3_9e7DwRhR3ILxQ--.17599S4; Fri, 30 Jul 2021 22:42:12 +0800 (CST) From: Gaoxiang Liu To: Maxime Coquelin , Chenbo Xia Cc: dev@dpdk.org, liugaoxiang@huawei.com, Gaoxiang Liu , stable@dpdk.org Date: Fri, 30 Jul 2021 22:41:57 +0800 Message-Id: <20210730144158.1981-1-gaoxiangliu0@163.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-CM-TRANSID: EsCowAD3_9e7DwRhR3ILxQ--.17599S4 X-Coremail-Antispam: 1Uf129KBjvdXoWrKr1fXrWkZF48ZFyUAFW5Wrg_yoWfGrX_Gr 17JF9rAF4UC3Wq93y7Ar1rZrySk3Z5GFykWa9Iq34rX3WUG3W5XrnIvrnxGanrWw4UCrZr Grs3Gwn8u34S9jkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUn038UUUUUU== X-Originating-IP: [39.182.55.95] X-CM-SenderInfo: xjdr5xxdqjzxjxq6il2tof0z/1tbiWwTfOlSIq-rmIgAAsz Subject: [dpdk-dev] [PATCH] 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 --- 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; }