Received: by 10.213.65.68 with SMTP id h4csp2123955imn; Sun, 8 Apr 2018 20:17:53 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+WRngzaS0jUUq9qb0pNqupL9VGrPyauAWC/BV7kwuJpvEKCU/3UEhl5JI1laSagCsipskb X-Received: by 2002:a17:902:900a:: with SMTP id a10-v6mr37813367plp.142.1523243873717; Sun, 08 Apr 2018 20:17:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243873; cv=none; d=google.com; s=arc-20160816; b=fz648bQOyxsELI7uacX1ABjOJO1WD87hj5fN/qTsNOaG25rHhIvp8nuhzI+topn+ob BY4qEzgx0W8LCDR13IUuVcr98sviq4Yq92zv8k8xIalp7hUHEcP752aVk2gsBUyBmewi ndneVtDF2g6vfbGb+jUJhgQSd8tv7gNC+w/pcy3enctn9u/e/qvFz4W04A4LXtd1IpQr EU4nlRJtI+NTGQ9xCUpnftsr+DkRypBPWZCG2ym1UkgsaUM9e9ewedK1ozYBNqB5YWNR evJl2b0SMJAW/yAH3O4exSoIczRszGr8gMdgA2s8iBiuGABdWd4IT2T45Ya89J0Aijc1 rvXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=tCu69jlAcXszeYZ4eWv3MYxUUWLLIrXL1GcXJK7ziAY=; b=azoz9g0vP+cYFDfet5M1Dl3yIQVd0MmrHJ0lzrBCGBneZ0h3veugRQHxtdusZMnX9g UGZxhWvWF2AxHJjc9HvSQQP0I+nyGTt3FTZocED70Crd9CUM7eC6ad7G/hMn7/dMLRuw hYq73XUek1W6gZeXqUpV9TTCjpA1VCTJPVhxlgIHnJZdpZRrGZ1fzwdIOVG+kVcCRvuO jO8hsOH+VZ1tO808MKMWXd9wWNTlD4LfSZO7sJDvw0UWa9PTEtLNtk/k5gjmmlzph9AY a5O/tvqwco7U+BsaKn0It1aEFxxLiL8GCXDKlS9v0CNxZDHDMO5b9aHoqFllSvqPMOJH 4QyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Z86Dw3hT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r18si12109956pfe.168.2018.04.08.20.17.16; Sun, 08 Apr 2018 20:17:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Z86Dw3hT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754855AbeDIDKG (ORCPT + 99 others); Sun, 8 Apr 2018 23:10:06 -0400 Received: from mail-by2nam03on0117.outbound.protection.outlook.com ([104.47.42.117]:63840 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755056AbeDIAYc (ORCPT ); Sun, 8 Apr 2018 20:24:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=tCu69jlAcXszeYZ4eWv3MYxUUWLLIrXL1GcXJK7ziAY=; b=Z86Dw3hTkF8Gy5rvQ5J+ks3jyGOijs/FOyCXj2TCHxhF9ydp9+SOreVvqajvfhXf6h+chlkJpL+rByt2MYfVDcNcRzu/KeKqepVSHTW4i/AThvxsG7Zz3V3LItzC2NEFTSj+R7OgXyawHeL2GQt6PYooLT0jI2eRzUoxEspSGwM= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0984.namprd21.prod.outlook.com (52.132.133.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:24:29 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:24:29 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Leon Romanovsky , Jason Gunthorpe , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 087/161] RDMA/mlx5: Avoid memory leak in case of XRCD dealloc failure Thread-Topic: [PATCH AUTOSEL for 4.14 087/161] RDMA/mlx5: Avoid memory leak in case of XRCD dealloc failure Thread-Index: AQHTz5ihqmfGm/V+CUiXkID/91m1Uw== Date: Mon, 9 Apr 2018 00:20:57 +0000 Message-ID: <20180409001936.162706-87-alexander.levin@microsoft.com> References: <20180409001936.162706-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001936.162706-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB0984;7:MMcMamac43x/rye7709lspBMqNEa7Avfm54CQoLmFkj15g6zSDspFYvycSc3DMhz985Ui8uATZzogSfNRYacodjyMLwXbpuCRH7kJlP9fe8S4JiNlfebvjhOyByAqTuJbn4nJV3bt/uwkLPNF6ezVPjKLsBgyR1Bg5zxORpRQYKx/RdpU18U5DoYQ7mxzSxiPQ+A6JRe1nWv9IyZSvf+Nx2dQQHO//4rQ431p4ApQNsGisjmO8GM/piqbmXHxC1g;20:rDuSfkfUzau6WIbm+CUGhodB5tB4nSv/BUJLtOVwI8yFReVDWVJlDjgPDA3Ej+KeKuSRqBuzcZ/SioPTJfYAkU3BWCv4RUzhEfBX4m64zC5p9oLQoJp6l5lQZo821aSNGWLT7vx0NSsNLixqwAmrsdNegssYMjY/jem6AQ6w+I8= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 6e4b9983-1873-47af-3ea7-08d59db04228 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0984; x-ms-traffictypediagnostic: DM5PR2101MB0984: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(146099531331640); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(6072148)(201708071742011);SRVR:DM5PR2101MB0984;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0984; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39380400002)(346002)(376002)(366004)(39860400002)(396003)(189003)(199004)(5250100002)(2501003)(110136005)(54906003)(6116002)(6436002)(11346002)(1076002)(486006)(25786009)(105586002)(2900100001)(102836004)(86612001)(3846002)(68736007)(107886003)(316002)(10290500003)(5660300001)(86362001)(2616005)(305945005)(4326008)(446003)(6486002)(22452003)(7736002)(476003)(8676002)(81156014)(81166006)(8936002)(6512007)(10090500001)(186003)(3280700002)(106356001)(76176011)(2906002)(99286004)(26005)(97736004)(59450400001)(14454004)(6666003)(478600001)(53936002)(6506007)(36756003)(72206003)(66066001)(3660700001)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0984;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: W7m3ZzTeqikdc2z6gJkU26D3DGRCL5TCSRDPKswWAsDXcQqOTNKeyimj5oA4vUqJ5qCFTioYiyq5chZMZ0EpQQJ1bi07rg87I60MZFQ5NsNuWSyyFlXN/KaLFjoQ7ypYJZdREsKWsNva5GN8YWKNaqmQtQCLkIDWQI2UpUt5t/2VCMJS5ohukzs8r1sSNxvwzdEzYqhn57TCF4ahhxQ+CNo9alhQzZ0L3r8IG2khPhcwC+DiwAbtmbYRxM4bAiPTADNRTAhMPZf1BVEATCHWcRfVlDXFnRDd/MeaHE3640gOkPsPcxkP4bX90jRVi1xJy0y05IXbVpY+4eh6o7IfkTLx8dZbGmhAVv+ly5e+I394Wjfn62FNP4hF1SDO4wo15J3wQvXOhOhu24PKNdTxJgaEk9Y+h07xoUheKt/dFeM= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6e4b9983-1873-47af-3ea7-08d59db04228 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:20:57.3314 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0984 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Leon Romanovsky [ Upstream commit b081808a66345ba725b77ecd8d759bee874cd937 ] Failure in XRCD FW deallocation command leaves memory leaked and returns error to the user which he can't do anything about it. This patch changes behavior to always free memory and always return success to the user. Fixes: e126ba97dba9 ("mlx5: Add driver for Mellanox Connect-IB adapters") Reviewed-by: Majd Dibbiny Signed-off-by: Leon Romanovsky Reviewed-by: Yuval Shaia Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/hw/mlx5/qp.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/q= p.c index c4d8cc1c2b1d..e1978d91a2f7 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c @@ -4636,13 +4636,10 @@ int mlx5_ib_dealloc_xrcd(struct ib_xrcd *xrcd) int err; =20 err =3D mlx5_core_xrcd_dealloc(dev->mdev, xrcdn); - if (err) { + if (err) mlx5_ib_warn(dev, "failed to dealloc xrcdn 0x%x\n", xrcdn); - return err; - } =20 kfree(xrcd); - return 0; } =20 --=20 2.15.1