From patchwork Wed Apr 17 14:43:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herakliusz Lipiec X-Patchwork-Id: 52875 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 C6DF21B706; Wed, 17 Apr 2019 16:43:07 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 1DF181B6C8 for ; Wed, 17 Apr 2019 16:43:06 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP; 17 Apr 2019 07:43:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,362,1549958400"; d="scan'208";a="338356913" Received: from silpixa00399499.ir.intel.com (HELO silpixa00399499.ger.corp.intel.com) ([10.237.222.133]) by fmsmga006.fm.intel.com with ESMTP; 17 Apr 2019 07:43:05 -0700 From: Herakliusz Lipiec To: matan@mellanox.com, shahafs@mellanox.com Cc: dev@dpdk.org, Herakliusz Lipiec , yskoh@mellanox.com Date: Wed, 17 Apr 2019 15:43:58 +0100 Message-Id: <20190417144358.23888-1-herakliusz.lipiec@intel.com> X-Mailer: git-send-email 2.17.2 Subject: [dpdk-dev] [PATCH 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 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: 0b259b8e9655 ("net/mlx4: enable secondary process to register DMA memory") Cc: yskoh@mellanox.com Signed-off-by: Herakliusz Lipiec --- 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];