From patchwork Tue Aug 3 23:30:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gaoxiang Liu X-Patchwork-Id: 96642 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 D23E1A0C45; Wed, 4 Aug 2021 01:30:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1F4A740E3C; Wed, 4 Aug 2021 01:30:57 +0200 (CEST) Received: from m12-13.163.com (m12-13.163.com [220.181.12.13]) by mails.dpdk.org (Postfix) with ESMTP id 006A74014F; Wed, 4 Aug 2021 01:30:54 +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=zV9P+ NL2JEgkp6yIg4xCwNR97JVFfkKSYs0dwvzPX5k=; b=NhIj0QFKnj6RoocL2TJGx YJnTX2SuKg3iL8db4X+6Uu/15e773CM59iV6NSCbMRgR5pHgb+dyj1cauUUICkF9 LYfB2b52JqYUGYpD16TTOlRS4DbiSSvQM48ByFwGVvyjXsqUmrze9VuH379Z2gam OXzfBjRZxHzTLxl9UHH+7M= Received: from DESKTOP-ONA2IA7.localdomain (unknown [39.182.55.95]) by smtp9 (Coremail) with SMTP id DcCowACXiwCl0QlhtX8zOA--.16877S4; Wed, 04 Aug 2021 07:30:50 +0800 (CST) From: Gaoxiang Liu To: Maxime Coquelin , Chenbo Xia Cc: dev@dpdk.org, liugaoxiang@huawei.com, Gaoxiang Liu , stable@dpdk.org Date: Wed, 4 Aug 2021 07:30:39 +0800 Message-Id: <20210803233040.492-1-gaoxiangliu0@163.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-CM-TRANSID: DcCowACXiwCl0QlhtX8zOA--.16877S4 X-Coremail-Antispam: 1Uf129KBjvdXoWrKr13KFWrJFy3Xw13GFW5GFg_yoWfGFb_GF 17JF9rAF4UC3Wq93y3Ar1fZrWSk3Z5GF18Wa9Iq34rX3WUG3W5XrnIvrnxGanrWw4UCrZr Grs3Gwn8u34S9jkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUnrhLUUUUUU== X-Originating-IP: [39.182.55.95] X-CM-SenderInfo: xjdr5xxdqjzxjxq6il2tof0z/xtbBQgrjOl++MxmW2gAAsW 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 --- 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; }