[5/8] ipc: fix pdump memleak

Message ID 20190417144158.23016-1-herakliusz.lipiec@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [1/8] ipc: fix rte_mp_request_sync memleak |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Herakliusz Lipiec April 17, 2019, 2:41 p.m. UTC
When sending multiple requests, rte_mp_request_sync
can succeed sending a few of those requests, but then
fail on a later one and in the end return with rc=-1.
The upper layers - e.g. device hotplug - currently
handles this case as if no messages were sent and no
memory for response buffers was allocated, which is
not true. Fixed by always freeing reply message buffers.

Fixes: 660098d61f57 ("pdump: use generic multi-process channel")
Cc: jianfeng.tan@intel.com
Cc: stable@dpdk.org
Signed-off-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
---
 lib/librte_pdump/rte_pdump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Pattan, Reshma April 18, 2019, 10:11 a.m. UTC | #1
> -----Original Message-----
> From: Lipiec, Herakliusz
> Sent: Wednesday, April 17, 2019 3:42 PM
> To: Pattan, Reshma <reshma.pattan@intel.com>
> Cc: dev@dpdk.org; Lipiec, Herakliusz <herakliusz.lipiec@intel.com>;
> jianfeng.tan@intel.com; stable@dpdk.org
> Subject: [PATCH 5/8] ipc: fix pdump memleak
> 
> When sending multiple requests, rte_mp_request_sync can succeed sending a
> few of those requests, but then fail on a later one and in the end return with rc=-
> 1.
> The upper layers - e.g. device hotplug - currently handles this case as if no
> messages were sent and no memory for response buffers was allocated, which
> is not true. Fixed by always freeing reply message buffers.
> 
> Fixes: 660098d61f57 ("pdump: use generic multi-process channel")
> Cc: jianfeng.tan@intel.com
> Cc: stable@dpdk.org
> Signed-off-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>

Might need to add Bugzilla id in commit message. Other than that,

Acked-By: Reshma Pattan <reshma.pattan@intel.com>
  

Patch

diff --git a/lib/librte_pdump/rte_pdump.c b/lib/librte_pdump/rte_pdump.c
index 14744b9ff..3787c3e32 100644
--- a/lib/librte_pdump/rte_pdump.c
+++ b/lib/librte_pdump/rte_pdump.c
@@ -525,8 +525,8 @@  pdump_prepare_client_request(char *device, uint16_t queue,
 		rte_errno = resp->err_value;
 		if (!resp->err_value)
 			ret = 0;
-		free(mp_reply.msgs);
 	}
+	free(mp_reply.msgs);
 
 	if (ret < 0)
 		RTE_LOG(ERR, PDUMP,