Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp173028imd; Wed, 31 Oct 2018 16:47:28 -0700 (PDT) X-Google-Smtp-Source: AJdET5fiikGpa+DF8q9GbLCl+QKuOwfhS0S8iFyzCVpq6yPe83JYl13C6eUgXRu50AbZaLVYdpBF X-Received: by 2002:a17:902:e193:: with SMTP id cd19-v6mr5337160plb.262.1541029648743; Wed, 31 Oct 2018 16:47:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541029648; cv=none; d=google.com; s=arc-20160816; b=SoZGM6SyomOB0zTnml3YBxa1LI3DkDO4k6YMPR8sHSeARkVMqCI1HkEFGQ93rRa/5v /178k/ZCntQh+pORpJ9eeg+dSC3BxA1F4ihgNeidlB3lPmXaIjuj5ywHCbZPsKE9uC0C 2+keHq7KiahhLkUBB4a7XKDnuID7dNBzYIsJQSJ+KP55N2SeBHv5UPpGG1ho5UTGu/ml 2BDWLyoyrBG4E203DzouzOK+EoraZLOLss5YHfBGG7ROxPTm64g0A8PTscB8aO19d22z ClOjMaA64c8OU8+MzLWgm0vumBoKP56DbX3gE2s1dS3uMmdNhrMslpSsAf7h7DKvpDI3 AspQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=GALHzY/PVLocDL6ydmygqZ5CsxdLbCqBp+UawgFAyjU=; b=biYsQZfGf8AZVoAFEvLtT8AbfgWmhaj3YCSrqr5ivxDpi2Agx19NHao+Azj8pkl29W TGTOvuUKvfpIvO/kaRYi2LFctH2OkGDek/b09OVj8HvLkUlODGLBN27q4z54MMII9grR CiQa47/EcgErq+td3csPtPxcTXKSX/76H4tlP6WZkGTLOCnA+khzxXtE562TMopqDbqe aLQjcTYVT2AFnB9zkRBKSQbklZ+LXgfmLC7YfJuOqNeywkOw5HoG/7hM/CnDY0XJcAYk g3aO6y/5JeG3EL2BcnJ1pSvyv9hhyMqqKmMcyiVlmKFjiA3RYFt/zztpnUo3cwvl7uH5 SbvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DGs9QE0D; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g11-v6si26905452pgs.179.2018.10.31.16.47.14; Wed, 31 Oct 2018 16:47:28 -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=@kernel.org header.s=default header.b=DGs9QE0D; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728856AbeKAIHY (ORCPT + 99 others); Thu, 1 Nov 2018 04:07:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:55128 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728646AbeKAIHX (ORCPT ); Thu, 1 Nov 2018 04:07:23 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5F2B42081B; Wed, 31 Oct 2018 23:07:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027233; bh=2h5AOeZchGzgjP0uM8Do63qTlbDMuIEEewO/zMK3tEM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DGs9QE0DZXhldeLx01+HsA0A+ewDbPBfsh4EmqME+WaZlBG3mQd+/dDsqb0G5Crhx 3IL4I2ORN14PJoIJ4Gx0POxbAC//77i9B5VYntMnw+n36w6QEsD5dHSJ2YKkmVVTCK vRUQJUt8cA+xEvIYEpcHfZw5xLbWSDo9oSxAXgJI= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Selvin Xavier , Jason Gunthorpe , Sasha Levin Subject: [PATCH AUTOSEL 4.19 100/146] RDMA/bnxt_re: Avoid accessing nq->bar_reg_iomem in failure case Date: Wed, 31 Oct 2018 19:04:55 -0400 Message-Id: <20181031230541.28822-100-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Selvin Xavier [ Upstream commit ed51efd2ce44091a858ad829f666727e7c95695e ] In the failure path, nq->bar_reg_iomem gets accessed without initializing. Avoid this by calling the bnxt_qplib_nq_stop_irq only if the initialization is complete. Reported-by: Dan Carpenter Fixes: 1ac5a4047975 ("RDMA/bnxt_re: Add bnxt_re RoCE driver") Fixes: 6e04b1035689 ("RDMA/bnxt_re: Fix broken RoCE driver due to recent L2 driver changes") Signed-off-by: Selvin Xavier Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/bnxt_re/qplib_fp.c b/drivers/infiniband/hw/bnxt_re/qplib_fp.c index 6ad0d46ab879..249efa0a6aba 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_fp.c +++ b/drivers/infiniband/hw/bnxt_re/qplib_fp.c @@ -360,7 +360,8 @@ void bnxt_qplib_disable_nq(struct bnxt_qplib_nq *nq) } /* Make sure the HW is stopped! */ - bnxt_qplib_nq_stop_irq(nq, true); + if (nq->requested) + bnxt_qplib_nq_stop_irq(nq, true); if (nq->bar_reg_iomem) iounmap(nq->bar_reg_iomem); -- 2.17.1