From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 79A451B4C1 for ; Tue, 23 Apr 2019 19:43:39 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Apr 2019 10:43:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,386,1549958400"; d="scan'208";a="226004808" Received: from silpixa00399499.ir.intel.com (HELO silpixa00399499.ger.corp.intel.com) ([10.237.222.133]) by orsmga001.jf.intel.com with ESMTP; 23 Apr 2019 10:43:37 -0700 From: Herakliusz Lipiec To: Shahaf Shuler , Yongseok Koh Cc: dev@dpdk.org, Herakliusz Lipiec Date: Tue, 23 Apr 2019 18:43:34 +0100 Message-Id: <20190423174334.19612-9-herakliusz.lipiec@intel.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190423174334.19612-1-herakliusz.lipiec@intel.com> References: <20190417143822.21276-1-herakliusz.lipiec@intel.com> <20190423174334.19612-1-herakliusz.lipiec@intel.com> Subject: [dpdk-dev] [PATCH v2 8/8] ipc: fix net/mlx5 memleak X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Apr 2019 17:43:40 -0000 When sending synchronous IPC requests, the caller must free the response buffer even if the request returned failure. Fix the code to correctly use the IPC API. Bugzilla ID:228 Fixes: 9a8ab29b84d3 ("net/mlx5: replace IPC socket with EAL API") Fixes: c18cf501a7af ("net/mlx5: enable secondary process to register DMA memory") Cc: yskoh@mellanox.com Signed-off-by: Herakliusz Lipiec --- drivers/net/mlx5/mlx5_mp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_mp.c b/drivers/net/mlx5/mlx5_mp.c index cea74adb6..c9915b1d5 100644 --- a/drivers/net/mlx5/mlx5_mp.c +++ b/drivers/net/mlx5/mlx5_mp.c @@ -258,6 +258,7 @@ mlx5_mp_req_mr_create(struct rte_eth_dev *dev, uintptr_t addr) if (ret) { DRV_LOG(ERR, "port %u request to primary process failed", dev->data->port_id); + free(mp_rep.msgs); return -rte_errno; } assert(mp_rep.nb_received == 1); @@ -295,7 +296,8 @@ mlx5_mp_req_verbs_cmd_fd(struct rte_eth_dev *dev) if (ret) { DRV_LOG(ERR, "port %u request to primary process failed", dev->data->port_id); - return -rte_errno; + ret = -rte_errno; + goto exit; } assert(mp_rep.nb_received == 1); mp_res = &mp_rep.msgs[0]; -- 2.17.2 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 3CBC6A05D3 for ; Tue, 23 Apr 2019 19:44:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BC0CA1B4CD; Tue, 23 Apr 2019 19:43:48 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 79A451B4C1 for ; Tue, 23 Apr 2019 19:43:39 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Apr 2019 10:43:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,386,1549958400"; d="scan'208";a="226004808" Received: from silpixa00399499.ir.intel.com (HELO silpixa00399499.ger.corp.intel.com) ([10.237.222.133]) by orsmga001.jf.intel.com with ESMTP; 23 Apr 2019 10:43:37 -0700 From: Herakliusz Lipiec To: Shahaf Shuler , Yongseok Koh Cc: dev@dpdk.org, Herakliusz Lipiec Date: Tue, 23 Apr 2019 18:43:34 +0100 Message-Id: <20190423174334.19612-9-herakliusz.lipiec@intel.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190423174334.19612-1-herakliusz.lipiec@intel.com> References: <20190417143822.21276-1-herakliusz.lipiec@intel.com> <20190423174334.19612-1-herakliusz.lipiec@intel.com> Subject: [dpdk-dev] [PATCH v2 8/8] ipc: fix net/mlx5 memleak X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190423174334.GNj1Eho2yAlSe7q4DKOHiSIdLpAXZIuz1Hjy_Hq9-DU@z> When sending synchronous IPC requests, the caller must free the response buffer even if the request returned failure. Fix the code to correctly use the IPC API. Bugzilla ID:228 Fixes: 9a8ab29b84d3 ("net/mlx5: replace IPC socket with EAL API") Fixes: c18cf501a7af ("net/mlx5: enable secondary process to register DMA memory") Cc: yskoh@mellanox.com Signed-off-by: Herakliusz Lipiec --- drivers/net/mlx5/mlx5_mp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_mp.c b/drivers/net/mlx5/mlx5_mp.c index cea74adb6..c9915b1d5 100644 --- a/drivers/net/mlx5/mlx5_mp.c +++ b/drivers/net/mlx5/mlx5_mp.c @@ -258,6 +258,7 @@ mlx5_mp_req_mr_create(struct rte_eth_dev *dev, uintptr_t addr) if (ret) { DRV_LOG(ERR, "port %u request to primary process failed", dev->data->port_id); + free(mp_rep.msgs); return -rte_errno; } assert(mp_rep.nb_received == 1); @@ -295,7 +296,8 @@ mlx5_mp_req_verbs_cmd_fd(struct rte_eth_dev *dev) if (ret) { DRV_LOG(ERR, "port %u request to primary process failed", dev->data->port_id); - return -rte_errno; + ret = -rte_errno; + goto exit; } assert(mp_rep.nb_received == 1); mp_res = &mp_rep.msgs[0]; -- 2.17.2