Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2302653imm; Thu, 7 Jun 2018 08:27:25 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLaLrDpQQb7jFc0J6OpUbwPqZqt2gnvRtm+ljJblZGeyzonyyGIUphoeofNzV0wwFQmFwUG X-Received: by 2002:a62:fcb:: with SMTP id 72-v6mr2199627pfp.231.1528385245278; Thu, 07 Jun 2018 08:27:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528385245; cv=none; d=google.com; s=arc-20160816; b=A6j+9xvfHXamUPDhaoS7vyAD7Aro70EIThUg+yF2BVFFN5b04uZpbYHsYVYzD/yiFl ijOCTkPykQY56Cni24YiyZiYt4F2FHnp3GZ0WFtdAasKRZ76u2ZnhLdHQMzuvqH6KNKd Dr5Con/NMeqd1TuOCfnEv0x44duBo3SCaj72v4UprL0mZzmPVv3YTDWqzfDasj1ykYB+ icVCJsGXUcDkuk5HFgyZLoN96poErkPqpiY6WTve/nfFQNM+ui9iBKwVs21f9NSHLeuQ MMAGVniPM/81kcgI1doEaHzbZdKTjPmoKc0N5c61wKMMwp0J6UJtqlD8eS3hZ3SMDDX6 QsSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=aysxQy6rZOPDadodn7Ca0Gxeb9tWZrXULB7KGKb11Ck=; b=YMZgKGF3v3vgsDpSCkZR7BcxrkJ6zwiLEnk+a/qV1UAscYCvtLUnOkm+JUYsMEUNBa HNW/jsuHXl9T5PH0CMyxQrC0AjETOE+MRF0gWW0l3kAzYODHjQCUwMjcMctldU8kVzCy E3UVRbBVtb3KxxIKcjKlibG1pn0vDGvgIKKuZiXTZhH/bWRft1Fn+1nlFMxCO+VcEDLZ aL87qzXAmXv8aem7ZCX5V1swYXU0346SUM+qQ9RuJN8amJRDEOLzGIiJ82kSOwB534sI BAqVQIDSysXZgq3eGlxV0yuPSmJhhsowbajp31AG+i8+4wP09sT/osVRbKlSgkjpRhnd E09g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r1-v6si21917773plb.172.2018.06.07.08.27.10; Thu, 07 Jun 2018 08:27: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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935518AbeFGO6K (ORCPT + 99 others); Thu, 7 Jun 2018 10:58:10 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:41163 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933329AbeFGO6I (ORCPT ); Thu, 7 Jun 2018 10:58:08 -0400 Received: from [148.252.241.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1fQvbl-0005Zv-WC; Thu, 07 Jun 2018 15:09:46 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvb4-0002xM-Jq; Thu, 07 Jun 2018 15:09:02 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Jason Gunthorpe" , "Majd Dibbiny" , "Leon Romanovsky" , "Yuval Shaia" Date: Thu, 07 Jun 2018 15:05:21 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 174/410] RDMA/mlx5: Avoid memory leak in case of XRCD dealloc failure In-Reply-To: X-SA-Exim-Connect-IP: 148.252.241.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.57-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Leon Romanovsky commit b081808a66345ba725b77ecd8d759bee874cd937 upstream. 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 [bwh: Backported to 3.16: adjust context] Signed-off-by: Ben Hutchings --- drivers/infiniband/hw/mlx5/qp.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c @@ -3050,12 +3050,9 @@ int mlx5_ib_dealloc_xrcd(struct ib_xrcd int err; err = 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; - } kfree(xrcd); - return 0; }