[v4,2/2] ipc: fix tap pmd memleak

Message ID 20190425124817.28409-3-herakliusz.lipiec@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series ipc: fix possible memleaks |

Checks

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

Commit Message

Herakliusz Lipiec April 25, 2019, 12:48 p.m. UTC
When sending synchronous IPC requests, the caller must free the response
buffer if the request was successful and reply is no longer needed.
Fix the code to correctly
use the IPC API.

Bugzilla ID: 228
Fixes: c9aa56edec8e ("net/tap: access primary process queues from secondary")
Cc: rasland@mellanox.com
Cc: stable@dpdk.org

Signed-off-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
---
 drivers/net/tap/rte_eth_tap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Wiles, Keith April 25, 2019, 6:14 p.m. UTC | #1
> On Apr 25, 2019, at 7:48 AM, Lipiec, Herakliusz <herakliusz.lipiec@intel.com> wrote:
> 
> When sending synchronous IPC requests, the caller must free the response
> buffer if the request was successful and reply is no longer needed.
> Fix the code to correctly
> use the IPC API.
> 
> Bugzilla ID: 228
> Fixes: c9aa56edec8e ("net/tap: access primary process queues from secondary")
> Cc: rasland@mellanox.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
> ---
> drivers/net/tap/rte_eth_tap.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
> index 7f74b5dc9..f8a4169c5 100644
> --- a/drivers/net/tap/rte_eth_tap.c
> +++ b/drivers/net/tap/rte_eth_tap.c
> @@ -2118,7 +2118,7 @@ tap_mp_attach_queues(const char *port_name, struct rte_eth_dev *dev)
> 		process_private->rxq_fds[queue] = reply->fds[fd_iterator++];
> 	for (queue = 0; queue < reply_param->txq_count; queue++)
> 		process_private->txq_fds[queue] = reply->fds[fd_iterator++];
> -
> +	free(reply);
> 	return 0;
> }

Acked-by: Keith Wiles <keith.wiles@intel.com>
> 
> -- 
> 2.17.2
> 

Regards,
Keith
  

Patch

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 7f74b5dc9..f8a4169c5 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -2118,7 +2118,7 @@  tap_mp_attach_queues(const char *port_name, struct rte_eth_dev *dev)
 		process_private->rxq_fds[queue] = reply->fds[fd_iterator++];
 	for (queue = 0; queue < reply_param->txq_count; queue++)
 		process_private->txq_fds[queue] = reply->fds[fd_iterator++];
-
+	free(reply);
 	return 0;
 }