From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 518BEA034E; Tue, 22 Feb 2022 19:19:31 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A089640E64; Tue, 22 Feb 2022 19:19:05 +0100 (CET) Received: from out203-205-221-192.mail.qq.com (out203-205-221-192.mail.qq.com [203.205.221.192]) by mails.dpdk.org (Postfix) with ESMTP id E403940DF4 for ; Tue, 22 Feb 2022 19:19:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1645553940; bh=R5pjihnX2RnKoFmdFZEKF/Y8vJaUyHZVgzXPwYDz8Vk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Lt4Fd/VKyt7aFS+y9XGGWIBs3V+1zuxd8g5DVg6QIiPbVBnWg+Yo5IJ7XMLMPkAMa BkAb+6Nsw3PBuWuvidhIML/7g4oBZtLxqcWu0KKznqxJzipWOPs0pYuWPkdItNqMed vTjo4o9M0dWwtaAvp2HIGKqlx10koLvo4yjnlz4s= Received: from localhost.localdomain ([111.193.130.237]) by newxmesmtplogicsvrszc6.qq.com (NewEsmtp) with SMTP id 49223207; Wed, 23 Feb 2022 02:18:18 +0800 X-QQ-mid: xmsmtpt1645553936tkv0smi68 Message-ID: X-QQ-XMAILINFO: MX+1SEN3H+wA5JwU9mjAHdk9KvlWT6ujPrE44FvCuWgeCDA2W4MQRYJ+buJLVi zrqnBrFsUx5lnRB5LSyxw165i2KHAXrJqm58WtHDea4E75U4pqRR8uv7qqCicGl0T1/9SZRwQiue 03dlHHXkbfCK3iyLfjNpx5Jed3JPracufhxtAJtj1B/SPCc2DTY0bIsEfHHp8xZ+qPsqWoJfxSDs Gz0SjLyG7x3iSNQ69ZfHT3GCsYAw/3G9xB9klo80TT/PKQYht0ChrXUDpM4MwVc8+8RSsTmUGZRa Cx2fBFP9q6huyMC0J4LbnIqS0/tDM+SpM7MwJ9qCk4h/4/ZAZnik7TqXisvYJPBcWas7nDuXtqXp 2zJLwu8BAmZtBJHqf0cuW7IKy4iNOy9+KMn8XhNWNJ7/2lpqJ0Dwx2kk3dnCQFAauKEv3XmTU5D3 rTP3Ztf1/g/tv1q4o91siVM/qQGQ++nFYq/SIIa26j+u5vT9O2/Bsn3qmiJPVPxwSRbRWcBbJOE4 IwGtfjEuK+4qkzfQV4KCXUUZtvbmgJBwJRHdgaJVRKe+I6BaojiElbiHEkeE4INcecqpO58LiVDe r2cmPrTnU5QV7ivu3xjXL+k92jov9QqDAOyCKmdbjeed/4jo2pJ0m9QoUivblmu/T+MLquzs6Li+ NUiR3E9abSg/j/et15hEOA2am6B1Q/ec+k3ntEkBbWZmGAqi2TmdYIqmOQRG98ZgeMYIm5OdIU+s ycYiYdjBFZDzENLz1EvBLKKObgIpoUfKZq36CuQmbqZgBypoJ7WUzn0rwvWDkUDMeBT84TxG8wS+ lQrTdkZ3BzQ4FhJtDP7SOed/GlXh6QvrOXjsq0alswRgk2TCQW3xXueL72qIz3jRV+esdCR6FySi LklhwKV79I8CQpwYoHQoY= From: Weiguo Li To: dev@dpdk.org Cc: adypodoman@gmail.com, xiaoyun.li@intel.com, tianfei.zhang@intel.com, bruce.richardson@intel.com, ivan.malov@oktetlabs.ru, jgrajcia@cisco.com, hkalra@marvell.com, ying.a.wang@intel.com, ting.xu@intel.com, simei.su@intel.com, qiming.yang@intel.com, motih@mellanox.com, shreyansh.jain@nxp.com, skoteshwar@marvell.com, stephen@networkplumber.org, kalesh-anakkur.purayil@broadcom.com, somnath.kotur@broadcom.com, declan.doherty@intel.com, gakhil@marvell.com, nicolas.chautru@intel.com Subject: [PATCH 09/20] net/dpaa: fix a memory leak when validation fail Date: Wed, 23 Feb 2022 02:18:07 +0800 X-OQ-MSGID: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 When buf_len validations fails and return, the mbuf is not freed which caused a memory leak. Fixes: 8cffdcbe85aa ("net/dpaa: support scattered Rx") Signed-off-by: Weiguo Li --- drivers/net/dpaa/dpaa_rxtx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index 956fe946fa..f66d975969 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -810,6 +810,7 @@ dpaa_eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf, } if (temp->buf_len < ((mbuf->nb_segs * sizeof(struct qm_sg_entry)) + temp->data_off)) { + rte_pktmbuf_free(temp); DPAA_PMD_ERR("Insufficient space in mbuf for SG entries"); return -1; } -- 2.25.1