From patchwork Tue Apr 23 17:43:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herakliusz Lipiec X-Patchwork-Id: 53016 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4E68F1B1F1; Tue, 23 Apr 2019 19:43:28 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id E40175F72; Tue, 23 Apr 2019 19:43:23 +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:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,386,1549958400"; d="scan'208";a="226004717" 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:21 -0700 From: Herakliusz Lipiec To: Cc: dev@dpdk.org, Herakliusz Lipiec , jianfeng.tan@intel.com, stable@dpdk.org Date: Tue, 23 Apr 2019 18:43:27 +0100 Message-Id: <20190423174334.19612-2-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 1/8] ipc: fix rte_mp_request_sync 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" 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 initializing message buffer to NULL. Bugzilla ID: 228 Fixes: 783b6e54971d ("eal: add synchronous multi-process communication") Cc: jianfeng.tan@intel.com Cc: stable@dpdk.org Signed-off-by: Herakliusz Lipiec Acked-by: Anatoly Burakov Acked-by: Darek Stojaczyk --- lib/librte_eal/common/eal_common_proc.c | 6 +++--- lib/librte_eal/common/include/rte_eal.h | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c index b46d644b3..abaff5164 100644 --- a/lib/librte_eal/common/eal_common_proc.c +++ b/lib/librte_eal/common/eal_common_proc.c @@ -927,13 +927,13 @@ rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply, RTE_LOG(DEBUG, EAL, "request: %s\n", req->name); - if (check_input(req) == false) - return -1; - reply->nb_sent = 0; reply->nb_received = 0; reply->msgs = NULL; + if (check_input(req) == false) + return -1; + if (internal_config.no_shconf) { RTE_LOG(DEBUG, EAL, "No shared files mode enabled, IPC is disabled\n"); return 0; diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h index 833433229..575f8119e 100644 --- a/lib/librte_eal/common/include/rte_eal.h +++ b/lib/librte_eal/common/include/rte_eal.h @@ -309,7 +309,8 @@ rte_mp_sendmsg(struct rte_mp_msg *msg); * This function sends a request message to the peer process, and will * block until receiving reply message from the peer process. * - * @note The caller is responsible to free reply->replies. + * @note The caller is responsible to free reply->replies (even if the function + * returned failure). * * @param req * The req argument contains the customized request message. From patchwork Tue Apr 23 17:43:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herakliusz Lipiec X-Patchwork-Id: 53017 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 51E8C1B4CC; Tue, 23 Apr 2019 19:43:31 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 068DB5F72; Tue, 23 Apr 2019 19:43:24 +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:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,386,1549958400"; d="scan'208";a="226004726" 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:23 -0700 From: Herakliusz Lipiec To: Cc: dev@dpdk.org, Herakliusz Lipiec , qi.z.zhang@intel.com, stable@dpdk.org Date: Tue, 23 Apr 2019 18:43:28 +0100 Message-Id: <20190423174334.19612-3-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 2/8] ipc: fix hotplug 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" 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: ac9e4a17370f ("eal: support attach/detach shared device from secondary") Cc: qi.z.zhang@intel.com Cc: stable@dpdk.org Signed-off-by: Herakliusz Lipiec Reviewed-by: Darek Stojaczyk --- lib/librte_eal/common/hotplug_mp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/librte_eal/common/hotplug_mp.c b/lib/librte_eal/common/hotplug_mp.c index 4052a5c7f..2c8366afa 100644 --- a/lib/librte_eal/common/hotplug_mp.c +++ b/lib/librte_eal/common/hotplug_mp.c @@ -377,6 +377,7 @@ int eal_dev_hotplug_request_to_primary(struct eal_dev_mp_req *req) ret = rte_mp_request_sync(&mp_req, &mp_reply, &ts); if (ret || mp_reply.nb_received != 1) { RTE_LOG(ERR, EAL, "cannot send request to primary"); + free(mp_reply.msgs); if (!ret) return -1; return ret; @@ -405,6 +406,7 @@ int eal_dev_hotplug_request_to_secondary(struct eal_dev_mp_req *req) ret = rte_mp_request_sync(&mp_req, &mp_reply, &ts); if (ret != 0) { RTE_LOG(ERR, EAL, "rte_mp_request_sync failed\n"); + free(mp_reply.msgs); return ret; } From patchwork Tue Apr 23 17:43:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herakliusz Lipiec X-Patchwork-Id: 53018 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 479A91B4D9; Tue, 23 Apr 2019 19:43:34 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 396D61B127; Tue, 23 Apr 2019 19:43:27 +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:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,386,1549958400"; d="scan'208";a="226004735" 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:25 -0700 From: Herakliusz Lipiec To: Cc: dev@dpdk.org, Herakliusz Lipiec , jianfeng.tan@intel.com, stable@dpdk.org Date: Tue, 23 Apr 2019 18:43:29 +0100 Message-Id: <20190423174334.19612-4-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 3/8] ipc: fix vdev 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" 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: cdb068f031c6 ("bus/vdev: scan by multi-process channel") Cc: jianfeng.tan@intel.com Cc: stable@dpdk.org Signed-off-by: Herakliusz Lipiec Reviewed-by: Darek Stojaczyk --- drivers/bus/vdev/vdev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c index 04f76a63f..7c43f2ddd 100644 --- a/drivers/bus/vdev/vdev.c +++ b/drivers/bus/vdev/vdev.c @@ -429,10 +429,9 @@ vdev_scan(void) mp_rep = &mp_reply.msgs[0]; resp = (struct vdev_param *)mp_rep->param; VDEV_LOG(INFO, "Received %d vdevs", resp->num); - free(mp_reply.msgs); } else VDEV_LOG(ERR, "Failed to request vdev from primary"); - + free(mp_reply.msgs); /* Fall through to allow private vdevs in secondary process */ } From patchwork Tue Apr 23 17:43:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herakliusz Lipiec X-Patchwork-Id: 53019 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 060871B4E3; Tue, 23 Apr 2019 19:43:37 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 87B941B296; Tue, 23 Apr 2019 19:43:29 +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:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,386,1549958400"; d="scan'208";a="226004755" 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:27 -0700 From: Herakliusz Lipiec To: Anatoly Burakov Cc: dev@dpdk.org, Herakliusz Lipiec , jianfeng.tan@intel.com, stable@dpdk.org Date: Tue, 23 Apr 2019 18:43:30 +0100 Message-Id: <20190423174334.19612-5-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 4/8] ipc: fix vfio 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" 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: 83a73c5fef66 ("vfio: use generic multi-process channel") Cc: jianfeng.tan@intel.com Cc: stable@dpdk.org Signed-off-by: Herakliusz Lipiec Acked-by: Anatoly Burakov Reviewed-by: Darek Stojaczyk --- lib/librte_eal/linux/eal/eal_vfio.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/librte_eal/linux/eal/eal_vfio.c b/lib/librte_eal/linux/eal/eal_vfio.c index 19e70bb66..d293df062 100644 --- a/lib/librte_eal/linux/eal/eal_vfio.c +++ b/lib/librte_eal/linux/eal/eal_vfio.c @@ -319,8 +319,8 @@ vfio_open_group_fd(int iommu_group_num) RTE_LOG(ERR, EAL, " bad VFIO group fd\n"); vfio_group_fd = 0; } - free(mp_reply.msgs); } + free(mp_reply.msgs); if (vfio_group_fd < 0) RTE_LOG(ERR, EAL, " cannot request group fd\n"); @@ -583,8 +583,8 @@ vfio_sync_default_container(void) p = (struct vfio_mp_param *)mp_rep->param; if (p->result == SOCKET_OK) iommu_type_id = p->iommu_type_id; - free(mp_reply.msgs); } + free(mp_reply.msgs); if (iommu_type_id < 0) { RTE_LOG(ERR, EAL, "Could not get IOMMU type for default container\n"); return -1; @@ -1050,8 +1050,8 @@ vfio_get_default_container_fd(void) free(mp_reply.msgs); return mp_rep->fds[0]; } - free(mp_reply.msgs); } + free(mp_reply.msgs); RTE_LOG(ERR, EAL, " cannot request default container fd\n"); return -1; @@ -1182,8 +1182,8 @@ rte_vfio_get_container_fd(void) free(mp_reply.msgs); return vfio_container_fd; } - free(mp_reply.msgs); } + free(mp_reply.msgs); RTE_LOG(ERR, EAL, " cannot request container fd\n"); return -1; From patchwork Tue Apr 23 17:43:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herakliusz Lipiec X-Patchwork-Id: 53020 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7329A1B4F9; Tue, 23 Apr 2019 19:43:40 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 347E01B4D2; Tue, 23 Apr 2019 19:43:32 +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:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,386,1549958400"; d="scan'208";a="226004775" 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:30 -0700 From: Herakliusz Lipiec To: Reshma Pattan Cc: dev@dpdk.org, Herakliusz Lipiec , jianfeng.tan@intel.com, stable@dpdk.org Date: Tue, 23 Apr 2019 18:43:31 +0100 Message-Id: <20190423174334.19612-6-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 5/8] ipc: fix pdump 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" 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: 660098d61f57 ("pdump: use generic multi-process channel") Cc: jianfeng.tan@intel.com Cc: stable@dpdk.org Signed-off-by: Herakliusz Lipiec Acked-By: Reshma Pattan --- lib/librte_pdump/rte_pdump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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, From patchwork Tue Apr 23 17:43:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herakliusz Lipiec X-Patchwork-Id: 53021 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 40B4E1B501; Tue, 23 Apr 2019 19:43:43 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id B401E1B4E1; Tue, 23 Apr 2019 19:43:34 +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:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,386,1549958400"; d="scan'208";a="226004784" 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:32 -0700 From: Herakliusz Lipiec To: Keith Wiles Cc: dev@dpdk.org, Herakliusz Lipiec , rasland@mellanox.com, stable@dpdk.org Date: Tue, 23 Apr 2019 18:43:32 +0100 Message-Id: <20190423174334.19612-7-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 6/8] ipc: fix tap pmd 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" 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: c9aa56edec8e ("net/tap: access primary process queues from secondary") Cc: rasland@mellanox.com Cc: stable@dpdk.org Signed-off-by: Herakliusz Lipiec --- drivers/net/tap/rte_eth_tap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index e9fda8cf6..d70412d62 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -2104,6 +2104,7 @@ tap_mp_attach_queues(const char *port_name, struct rte_eth_dev *dev) if (ret < 0) { TAP_LOG(ERR, "Failed to request queues from primary: %d", rte_errno); + free(replies.msgs); return -1; } reply = &replies.msgs[0]; @@ -2119,6 +2120,7 @@ tap_mp_attach_queues(const char *port_name, struct rte_eth_dev *dev) for (queue = 0; queue < reply_param->txq_count; queue++) process_private->txq_fds[queue] = reply->fds[fd_iterator++]; + free(replies.msgs); return 0; } From patchwork Tue Apr 23 17:43:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herakliusz Lipiec X-Patchwork-Id: 53022 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C2C891B509; Tue, 23 Apr 2019 19:43:45 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 371D71B4E8 for ; Tue, 23 Apr 2019 19:43:37 +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:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,386,1549958400"; d="scan'208";a="226004793" 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:35 -0700 From: Herakliusz Lipiec To: Matan Azrad , Shahaf Shuler Cc: dev@dpdk.org, Herakliusz Lipiec , yskoh@mellanox.com Date: Tue, 23 Apr 2019 18:43:33 +0100 Message-Id: <20190423174334.19612-8-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 7/8] ipc: fix net/mlx4 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" 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: 0b259b8e9655 ("net/mlx4: enable secondary process to register DMA memory") Cc: yskoh@mellanox.com Signed-off-by: Herakliusz Lipiec Acked-by: Yongseok Koh --- drivers/net/mlx4/mlx4_mp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx4/mlx4_mp.c b/drivers/net/mlx4/mlx4_mp.c index 183622453..f4cff7486 100644 --- a/drivers/net/mlx4/mlx4_mp.c +++ b/drivers/net/mlx4/mlx4_mp.c @@ -255,6 +255,7 @@ mlx4_mp_req_mr_create(struct rte_eth_dev *dev, uintptr_t addr) if (ret) { ERROR("port %u request to primary process failed", dev->data->port_id); + free(mp_rep.msgs); return -rte_errno; } assert(mp_rep.nb_received == 1); @@ -292,7 +293,8 @@ mlx4_mp_req_verbs_cmd_fd(struct rte_eth_dev *dev) if (ret) { ERROR("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]; From patchwork Tue Apr 23 17:43:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herakliusz Lipiec X-Patchwork-Id: 53023 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org 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" 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 Acked-by: Yongseok Koh --- 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];