From patchwork Tue Aug 31 14:39:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gaoxiang Liu X-Patchwork-Id: 97618 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 75450A0C46; Tue, 31 Aug 2021 16:40:17 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1978E4013F; Tue, 31 Aug 2021 16:40:17 +0200 (CEST) Received: from m12-14.163.com (m12-14.163.com [220.181.12.14]) by mails.dpdk.org (Postfix) with ESMTP id B834440041; Tue, 31 Aug 2021 16:40:14 +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=1c/iz 6uF+2zPXWQxX4fLUhVzRRFRM5rkuA2s8/mY4CU=; b=OZ/V0qohNNj351pYwD5dw eI4cwZubfH6yLg8RQ0JZxSeQEXvhkm+lxj4ANLGfpQlCX+DmAyB8neW2a0uK9cSk gRcgJAwPwwa0npwy5O4GJEdr9yIG+jkohE+JAg7JcGATAZZq+kW9VywFtqBh8Kjn soTYKqwveJfODPnpUETmqI= Received: from DESKTOP-ONA2IA7.localdomain (unknown [39.182.52.167]) by smtp10 (Coremail) with SMTP id DsCowADHDIJBPy5hqvCpFA--.32569S4; Tue, 31 Aug 2021 22:40:10 +0800 (CST) From: Gaoxiang Liu To: maxime.coquelin@redhat.com, chenbo.xia@intel.com Cc: dev@dpdk.org, liugaoxiang@huawei.com, Gaoxiang Liu , stable@dpdk.org Date: Tue, 31 Aug 2021 22:39:51 +0800 Message-Id: <20210831143951.93-1-gaoxiangliu0@163.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210829085047.95-1-gaoxiangliu0@163.com> References: <20210829085047.95-1-gaoxiangliu0@163.com> MIME-Version: 1.0 X-CM-TRANSID: DsCowADHDIJBPy5hqvCpFA--.32569S4 X-Coremail-Antispam: 1Uf129KBjvdXoWrKr1kJry8Aw4fArW8WF4fAFb_yoWftFX_G3 W2qF9rAr45C3Wq93y5Arn3XryfK3Z5GFykWa9Iq34Fqa47C3W5XFnIvrsxGFsrWw4UCrZr Grs3G3Z8u34SkjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUUqg4DUUUUU== X-Originating-IP: [39.182.52.167] X-CM-SenderInfo: xjdr5xxdqjzxjxq6il2tof0z/xtbB3QoAOmBHKML2qAAAs+ Subject: [dpdk-dev] [PATCH v4] 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 virtio_init_queue returns error, 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 Reviewed-by: Chenbo Xia --- v2: * Fix spelling warning v3: * Add detailed log v4: * Update the email address --- 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; }