Received: by 10.213.65.68 with SMTP id h4csp2147791imn; Sun, 8 Apr 2018 20:57:38 -0700 (PDT) X-Google-Smtp-Source: AIpwx48Q0gYsLKpeaOCfEff6rhiw1Mw6ckTfeG2eEhvrH8KAuwpvRtxdXEe7axuLMGAAhWcTXUDT X-Received: by 10.98.76.196 with SMTP id e65mr28147305pfj.35.1523246258652; Sun, 08 Apr 2018 20:57:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523246258; cv=none; d=google.com; s=arc-20160816; b=qCTQTLtnGMTKHwt9e3ulOfKfMSpcTiSkE0o3kJ9KVSEygvHKBYRNg/9YMr+Uk18arr F8oBkWxsD0pKYXlBUlkqV7KnRHI+5H89CikqD91xouyx0Oe9w3G/hTUCHRRDrtyeGF/X hSPMVeLzd7CVc0keFKSYXaH+LAs+V+1NZnNdCtqAMpr+R0y+jpR3IPzVT8oRHR7ipdEJ vd4bd53jC0FaDkntC5umuAZy/qQM5cyIdgaZex3Cn+/sUsfntf7HA8jx50PYqK2Synwl TuMdxldvDi3LgS/MOeJCAuRxrw6BS1Yh/ZweAOy/Fay+NLIUOvCaCbMHFE8fqH4vLmxS OmKA== 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=DW3HJLx7xgNYqP7bhdRqup1hLIm0yVNx1gfodwEeP1I=; b=Cmm5n7F0tkhaaQcl6BiwCVSjdHlI6ZaRmf6MalOPQR0SJFqJMsPe+3Gvj/YLGOFYHN n7lbN5yW5ltN//x+jhl/l3N5YMu/K5RhdCK9+KBGv1fzbiXzFCcx1KljevHKpsUUkWRh CjZrzHAHKdA1tvZcG7q3zJ9yLp6e0cbuqp0kYaDNsulqUH4A0AZRR6A7s/LAx1dfFAhG pX3mLD4D9v+alwTLBNWRoA0VVxgq5tryGmTSh6mOwyvdMq2IKqHYslPdhQnbDGrxUohU cBmcVWR/LVhiI1jaswGz0k67oHKHwij/Q4ZNeffGCiOytMnmhJI/9cqpHkI3B6lgX6lb dJyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=HyMy3HxI; 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 p11-v6si13683456plk.574.2018.04.08.20.57.01; Sun, 08 Apr 2018 20:57:38 -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=HyMy3HxI; 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 S1753169AbeDIDwO (ORCPT + 99 others); Sun, 8 Apr 2018 23:52:14 -0400 Received: from mail-by2nam03on0122.outbound.protection.outlook.com ([104.47.42.122]:11088 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754029AbeDIAT0 (ORCPT ); Sun, 8 Apr 2018 20:19:26 -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=DW3HJLx7xgNYqP7bhdRqup1hLIm0yVNx1gfodwEeP1I=; b=HyMy3HxIv7E+33pu9NurZrNWAgofC5QiZ+UDqVJ2/ukComGeXiLclpK5rYzjcd3jZTIBCjVVgm0OruYy3FsbV/+dv8GCERa5SdoTPaFtu2/CqhzXe5dt7eW4xZz+aeGU2Q9gDdrJ4bhVH95T3MEIbXVfkQf5tpH7NCXtrpWH2BE= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1063.namprd21.prod.outlook.com (52.132.128.39) 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:19:21 +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:19:21 +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.15 103/189] RDMA/mlx5: Avoid memory leak in case of XRCD dealloc failure Thread-Topic: [PATCH AUTOSEL for 4.15 103/189] RDMA/mlx5: Avoid memory leak in case of XRCD dealloc failure Thread-Index: AQHTz5g8hrgdzwrbfE6t1XqHCFDA4A== Date: Mon, 9 Apr 2018 00:18:07 +0000 Message-ID: <20180409001637.162453-103-alexander.levin@microsoft.com> References: <20180409001637.162453-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001637.162453-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;DM5PR2101MB1063;7:qvyWPmYAE2MuPUlBkfnLvOsJwAK/bBARgYqlD+zkWmW23sf10RuNWCONAnm2oN3CdMMkWRTjt3qc4p3SNwGdqHTQ2wWjtZk3pwPeezNc88pJQ8vjvGoCuJPgvY5KEyjHj7MhJAbeeV4f5HQQW9DoGsEPowj4+qpPY9/1jkcHhEnV1YEO/kdXVsOc3juDh1+q5oigtDohsnPkmbq9hKwRzHIE0dG3aB1rv4Dx+K8xrI89qGXm2EZJfLpytR0YC5ld;20:7/+hFESY4/760Mk4R5WkCo1q0PYoj192gKahOxPRPeOs2dIIkGcwewP1K1nBvxUVBTI7Fd2oobU6gNjlGAXPb3CVlTk6SUajeHAW/jaGLm4oHRUjbcCji9DrVCx88Le8d4x1qVb1Si7ILaxTyRBu3FY5KtPFkX9VnGoxhXr93aE= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 8daee700-2635-4808-b069-08d59daf8ad5 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1063; x-ms-traffictypediagnostic: DM5PR2101MB1063: 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)(5005006)(8121501046)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011);SRVR:DM5PR2101MB1063;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1063; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(39380400002)(39860400002)(376002)(396003)(366004)(189003)(199004)(2900100001)(6436002)(7736002)(10090500001)(102836004)(3660700001)(6506007)(76176011)(305945005)(4326008)(5250100002)(97736004)(26005)(25786009)(6512007)(2906002)(81166006)(106356001)(107886003)(68736007)(14454004)(86612001)(66066001)(10290500003)(59450400001)(6666003)(5660300001)(81156014)(478600001)(476003)(486006)(6486002)(72206003)(3280700002)(99286004)(105586002)(36756003)(1076002)(2616005)(11346002)(53936002)(446003)(8676002)(186003)(3846002)(54906003)(6116002)(2501003)(8936002)(316002)(110136005)(86362001)(22452003)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1063;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: mFWR7UchR8p1P8gWawdcMhfe8MX453T4e6T2y1V90FbJ9xQ9EPz/aaI5yZuby7At5FCXHMhbD1K2q4iZLSXpO0hoIYToA/u3aaDkpl/rYisB55NQwDiqUT6HGTx5EKC1kVg5+RPb4CtvPKgWxcxsSX/vMKHFdjg/xIr0KNZc24NN4N4lRIr4lZsfkYaBZe6uXkHMSmyO8fWEwWzEshFZuSXbye8xohaZpSijx5nZCXgxDxdHPoEx51ELXsc0nEo4YFwzx7/h1wFkA5DDm8H+cb3MEq7Dg0H7ElQDAFELg22iMgbAvCscGhqZtXvWAA6ZrWFmuRyT94OQo5WPOZcQ5kMHvRb7Ug1AzQhiyAEjNul2OyG4N2zpuzkq+4lvDhA7+W+zB2/ONfQySYrrOrRRTvh4q9NK/czDl6klQBRvv9o= 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: 8daee700-2635-4808-b069-08d59daf8ad5 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:18:07.3658 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1063 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 47b39c3e9812..d28f5662cf90 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c @@ -4694,13 +4694,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