From patchwork Fri Dec 1 08:03:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunjian Wang X-Patchwork-Id: 134741 X-Patchwork-Delegate: ferruh.yigit@amd.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 EAB3B43419; Fri, 1 Dec 2023 09:03:35 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 739DB402B9; Fri, 1 Dec 2023 09:03:35 +0100 (CET) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id C9F75402B6; Fri, 1 Dec 2023 09:03:33 +0100 (CET) Received: from dggpemm500008.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4ShQT20rnfz1P95s; Fri, 1 Dec 2023 15:59:50 +0800 (CST) Received: from localhost (10.174.242.157) by dggpemm500008.china.huawei.com (7.185.36.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 1 Dec 2023 16:03:30 +0800 From: Yunjian Wang To: CC: , , , , Yunjian Wang , Subject: [dpdk-dev] [PATCH] net/af_xdp: fix memzone leak in error path Date: Fri, 1 Dec 2023 16:03:07 +0800 Message-ID: <64117415a68e8c920efdf905f799b26dcbc3f8fb.1701415014.git.wangyunjian@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 MIME-Version: 1.0 X-Originating-IP: [10.174.242.157] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500008.china.huawei.com (7.185.36.136) X-CFilter-Loop: Reflected 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 In xdp_umem_configure() allocated memzone for the 'umem', we should free it when xsk_umem__create() call fails, otherwise it will lead to memory zone leak. Fixes: f1debd77efaf ("net/af_xdp: introduce AF_XDP PMD") Cc: stable@dpdk.org Signed-off-by: Yunjian Wang --- drivers/net/af_xdp/rte_eth_af_xdp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index 2a20a6960c..2a1fdafb3c 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -1229,6 +1229,7 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals, if (ret) { AF_XDP_LOG(ERR, "Failed to create umem\n"); + rte_memzone_free(mz); goto err; } umem->mz = mz;