Message ID | b5b5d4a5eb98e92a9a06d51a88814ed9f2976e57.1641627917.git.wangyunjian@huawei.com (mailing list archive) |
---|---|
State | Accepted, archived |
Delegated to: | Ferruh Yigit |
Headers | show |
Series | ethdev: fix rxq_state leak in error path | expand |
Context | Check | Description |
---|---|---|
ci/iol-abi-testing | success | Testing PASS |
ci/iol-aarch64-compile-testing | success | Testing PASS |
ci/iol-x86_64-compile-testing | success | Testing PASS |
ci/iol-x86_64-unit-testing | success | Testing PASS |
ci/iol-aarch64-unit-testing | success | Testing PASS |
ci/iol-intel-Functional | success | Functional Testing PASS |
ci/iol-intel-Performance | success | Performance Testing PASS |
ci/iol-broadcom-Performance | success | Performance Testing PASS |
ci/iol-broadcom-Functional | success | Functional Testing PASS |
ci/iol-mellanox-Performance | success | Performance Testing PASS |
ci/github-robot: build | success | github build: passed |
ci/intel-Testing | success | Testing PASS |
ci/Intel-compilation | success | Compilation OK |
ci/checkpatch | success | coding style OK |
On 1/8/2022 7:51 AM, Yunjian Wang wrote: > 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> Applied to dpdk-next-net/main, thanks.
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index a1d475a292..29e21ad580 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -6320,8 +6320,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);
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> --- lib/ethdev/rte_ethdev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)