diff mbox series

net/fm10k: fix memory leak when thresh check fails

Message ID a2539f03a15953d1b8f0511a9851a7a00b756867.1601296012.git.wangyunjian@huawei.com (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers show
Series net/fm10k: fix memory leak when thresh check fails | expand

Checks

Context Check Description
ci/Intel-compilation fail Compilation issues
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/checkpatch success coding style OK

Commit Message

wangyunjian Sept. 28, 2020, 12:44 p.m. UTC
From: Yunjian Wang <wangyunjian@huawei.com>

In fm10k_rx_queue_setup(), we allocate memory for the queue
structure but not released when thresh check fails.

Fixes: 6cfe8969c969 ("fm10k: add Rx queue setup/release")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 drivers/net/fm10k/fm10k_ethdev.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Qi Zhang Sept. 28, 2020, 1:32 p.m. UTC | #1
> -----Original Message-----
> From: wangyunjian <wangyunjian@huawei.com>
> Sent: Monday, September 28, 2020 8:45 PM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Wang, Xiao W
> <xiao.w.wang@intel.com>; jerry.lilijun@huawei.com; xudingke@huawei.com;
> Yunjian Wang <wangyunjian@huawei.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] net/fm10k: fix memory leak when thresh check
> fails
> 
> From: Yunjian Wang <wangyunjian@huawei.com>
> 
> In fm10k_rx_queue_setup(), we allocate memory for the queue structure but
> not released when thresh check fails.
> 
> Fixes: 6cfe8969c969 ("fm10k: add Rx queue setup/release")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi
diff mbox series

Patch

diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 5771d83b5..98e396b8e 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -1841,9 +1841,10 @@  fm10k_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_id,
 	q->tail_ptr = (volatile uint32_t *)
 		&((uint32_t *)hw->hw_addr)[FM10K_RDT(queue_id)];
 	q->offloads = offloads;
-	if (handle_rxconf(q, conf))
+	if (handle_rxconf(q, conf)) {
+		rte_free(q);
 		return -EINVAL;
-
+	}
 	/* allocate memory for the software ring */
 	q->sw_ring = rte_zmalloc_socket("fm10k sw ring",
 			(nb_desc + q->nb_fake_desc) * sizeof(struct rte_mbuf *),