40 lines
1.2 KiB
Diff
40 lines
1.2 KiB
Diff
|
|
From 8cd9ea525b1e9c2a966fdf3616d68c7037b3820a Mon Sep 17 00:00:00 2001
|
||
|
|
From: Yunjian Wang <wangyunjian@huawei.com>
|
||
|
|
Date: Sat, 8 Jan 2022 15:51:57 +0800
|
||
|
|
Subject: ethdev: fix Rx queue telemetry memory leak on failure
|
||
|
|
|
||
|
|
[ upstream commit 52b49ea06ffb2cfbef8fe9578149f1e2dba99e89 ]
|
||
|
|
|
||
|
|
In eth_dev_handle_port_info() allocated memory for rxq_state,
|
||
|
|
we should free it when error happens, otherwise it will lead
|
||
|
|
to memory leak.
|
||
|
|
|
||
|
|
Fixes: 58b43c1ddfd1 ("ethdev: add telemetry endpoint for device info")
|
||
|
|
Cc: stable@dpdk.org
|
||
|
|
|
||
|
|
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
|
||
|
|
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
|
||
|
|
---
|
||
|
|
lib/ethdev/rte_ethdev.c | 4 +++-
|
||
|
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
||
|
|
|
||
|
|
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
|
||
|
|
index df5a627cbe..d466efffc7 100644
|
||
|
|
--- a/lib/ethdev/rte_ethdev.c
|
||
|
|
+++ b/lib/ethdev/rte_ethdev.c
|
||
|
|
@@ -6383,8 +6383,10 @@ eth_dev_handle_port_info(const char *cmd __rte_unused,
|
||
|
|
return -ENOMEM;
|
||
|
|
|
||
|
|
txq_state = rte_tel_data_alloc();
|
||
|
|
- if (!txq_state)
|
||
|
|
+ if (!txq_state) {
|
||
|
|
+ rte_tel_data_free(rxq_state);
|
||
|
|
return -ENOMEM;
|
||
|
|
+ }
|
||
|
|
|
||
|
|
rte_tel_data_start_dict(d);
|
||
|
|
rte_tel_data_add_dict_string(d, "name", eth_dev->data->name);
|
||
|
|
--
|
||
|
|
2.23.0
|
||
|
|
|