Received: by 10.213.65.68 with SMTP id h4csp2114232imn; Sun, 8 Apr 2018 20:04:25 -0700 (PDT) X-Google-Smtp-Source: AIpwx484gBc71K7FXvGzj8q9MqXoZllSFV0Ks7nTLkQTYk3H6ARnYAG0m+deSFFxQP9X3OXPoGZI X-Received: by 2002:a17:902:1e3:: with SMTP id b90-v6mr36835938plb.155.1523243065920; Sun, 08 Apr 2018 20:04:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243065; cv=none; d=google.com; s=arc-20160816; b=BMZ5zmR5toY4uHaZCm/s68H+hhbgebSPC5ceNXJIY5MP/HPr0LiEC6nMKbbSO3Lq2W 5uvTR9EhOt1R9tftZfYLjFUhd3X4Ao5XVyT0XQLy3KYeftihjqg9qrMrZn53VJcHH8us 0HM5OsioS7KOjSJ6P1pWpDWjIdxkNiiupM3/oA/OdJNqc00WqSbiFsadXhcqYfjWz5Lg w5Z3D0TYjkQ7K7hOqpbSsCd8a+0CF4RLIWSKxfqYsoOnGx2S9EiPCutwbDigGRw+FibV xzfZa+3sQdM5jgeFQb7tyyXEBN2nANOo/Jd0SS6xLbI/54d7hwzbJhUjvaKF+PiBpTJS MN8w== 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=1i2zAa7fcK88MkMs1LRtn7SuXmXwQ+ES5VyRtbpE6fY=; b=JDwSWKxL0zWY936ceUMwemBrrcmnFLnRTBm31f8lJDUfhgXV/rjUYe52WAFP1Ea/0k n6ZstajrbT/DJkbjwcws6jsuoV9fwTqWWywgTik5c0nGdHTyotNp4DV3vncDHNe0DejQ synodGRBWpDvN5B+FgJRjklezIjKDIHHEbm6Btpzy70Hu3hZnKo2o2T/3QpmQKCoiOCi KKBF0LAxwX6eqZKajCgDZDXw15xDU1o6DBvinxMK0JBVw0nwWFB0f3jQx3XHRIzo758f vvSG8RvppCYQ8qD4J4hN6nCvNVN+SwZ0PjuX1B11EC03Hc50+SKdfhTGr18l9XJmwtGn jrZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=oG49BTht; 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 94-v6si13736013ple.56.2018.04.08.20.03.49; Sun, 08 Apr 2018 20:04:25 -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=oG49BTht; 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 S932368AbeDIAdy (ORCPT + 99 others); Sun, 8 Apr 2018 20:33:54 -0400 Received: from mail-by2nam01on0130.outbound.protection.outlook.com ([104.47.34.130]:18358 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932331AbeDIAds (ORCPT ); Sun, 8 Apr 2018 20:33:48 -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=1i2zAa7fcK88MkMs1LRtn7SuXmXwQ+ES5VyRtbpE6fY=; b=oG49BThtNMg6+41n04M9KMhz77mZRZ3985vu5gW0VZ5uOH261hTu2NbHsSHrsgyLsN1kXboJzpHBXYSeF1PTmUypmP+FuCZwP2NDW1PzlI8/+AAf3vvBBXTWIdc3IGdRTsHPFn4P1RNaNziCeqFWmG75yy1756YecWtgtOnsAmA= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0806.namprd21.prod.outlook.com (10.167.107.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.3; Mon, 9 Apr 2018 00:33:46 +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:33:46 +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.9 249/293] RDMA/mlx5: Avoid memory leak in case of XRCD dealloc failure Thread-Topic: [PATCH AUTOSEL for 4.9 249/293] RDMA/mlx5: Avoid memory leak in case of XRCD dealloc failure Thread-Index: AQHTz5lZqSZaik7B4Um/ZyN9B87M4Q== Date: Mon, 9 Apr 2018 00:26:06 +0000 Message-ID: <20180409002239.163177-249-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-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;DM5PR2101MB0806;7:J85nSL5w9e81DtSkYoXfOmatm6ad2WiIo/z4WApgBUggxd6XAMo0Vn6eZ/PHuumo8q9PqdMvKlhGamEO7AyzcaNOqU/whqKsYecCCbCXLqh66s2sLvSliCjAcoN+j5+ZU5aDM2a+TQBWO4D6+ySK/F0esuBREqqnhc83QrX61F8fu1BDTnKyqsqGNf9/3K0ORSZp/ylu7E6CBY/VHMUVbVyv/zUTAiOUcsNImxUd/lD6WT4NSY6M0acTXg+qUT85;20:Z3kQlu6SpoSavbRVaf7HAMxRRTCvJkJZJX5Ei2/xb+SRbZBKSHdptpVJODmO8zy7tKWJov1vLAgz9oRBcEsSwiUx3RqpFz9zALb2ao9wSLY66fNfUa66l0PtxjT68rUY5TUzyetbPWd+sCAH7rdvvcik2bE5/jgZzdEM5bS9YRE= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 7cd66509-f0e3-4ced-da24-08d59db18e2b x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0806; x-ms-traffictypediagnostic: DM5PR2101MB0806: 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)(3231221)(944501327)(52105095)(93006095)(93001095)(10201501046)(3002001)(6055026)(61426038)(61427038)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123558120)(6072148)(201708071742011);SRVR:DM5PR2101MB0806;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0806; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(39860400002)(376002)(396003)(366004)(39380400002)(199004)(189003)(2906002)(25786009)(2501003)(10290500003)(476003)(11346002)(446003)(97736004)(5250100002)(68736007)(2616005)(102836004)(6506007)(59450400001)(3846002)(3660700001)(486006)(3280700002)(305945005)(6666003)(99286004)(5660300001)(76176011)(1076002)(186003)(26005)(7736002)(6116002)(81156014)(81166006)(86612001)(4326008)(105586002)(10090500001)(2900100001)(54906003)(22452003)(316002)(36756003)(110136005)(107886003)(8676002)(6436002)(478600001)(53936002)(66066001)(6486002)(6512007)(86362001)(14454004)(72206003)(8936002)(106356001)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0806;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: QriT/0Z1jXusAX+Wn+qlnadj0Ej+RFWWsYfyEltTrffAkQ2Bl7Bz0uHPsKznQTlvt5s+dTVJG6V/K0iB8Ukn1KrtTCetznUmoYjBaqpt+CIBk4vSpcqwjkYgxbawmLVdSE3qcSFZ99nfckiMAKY+tPGAvRMrqEeWSDK25bsFrCxi4gxbBZ32Nt+F+CLGZoySQoABN2f8be5Rl8vha8/b6uQ7kfFLwL6QLTobP3p1ZhxZ14/m3WsDgps917nQLeMETc75TDugl0e6ojwg3+sls3xjycJILLSX7AtTh/Yupd3jdBO9rI00RqkMWjl4uin4hKdy2oKyYlnNSF2BvBJHwbXtGVll0qgVDA4qaUuWo+jEXK5nuCtZ/Lb8ENSoZauvPDrESfwJEJemWqtJ8815Wo4ipjmObDokYyniSiDAf9w= 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: 7cd66509-f0e3-4ced-da24-08d59db18e2b X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:26:06.8943 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0806 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 403df3591d29..80ced0372e22 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c @@ -4605,13 +4605,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