Return-Path: Received: from mail-sn1nam01on0097.outbound.protection.outlook.com ([104.47.32.97]:64040 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933320AbeDIAk3 (ORCPT ); Sun, 8 Apr 2018 20:40:29 -0400 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Dan Carpenter , "Martin K . Petersen" , Sasha Levin Subject: [PATCH AUTOSEL for 3.18 048/101] scsi: bnx2i: missing error code in bnx2i_ep_connect() Date: Mon, 9 Apr 2018 00:35:58 +0000 Message-ID: <20180409003505.164715-48-alexander.levin@microsoft.com> References: <20180409003505.164715-1-alexander.levin@microsoft.com> In-Reply-To: <20180409003505.164715-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Dan Carpenter [ Upstream commit 1d32a62c74b3bcb69822b0f4745af5410cfec3a7 ] If bnx2i_map_ep_dbell_regs() then we accidentally return NULL instead of an error pointer. It results in a NULL dereference in iscsi_if_ep_connect(). Fixes: cf4e6363859d ("[SCSI] bnx2i: Add bnx2i iSCSI driver.") Signed-off-by: Dan Carpenter Reviewed-by: Johannes Thumshirn Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/bnx2i/bnx2i_iscsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_is= csi.c index 7a36388822aa..6644618ac85c 100644 --- a/drivers/scsi/bnx2i/bnx2i_iscsi.c +++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c @@ -1907,7 +1907,8 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct= Scsi_Host *shost, =20 bnx2i_ep_active_list_add(hba, bnx2i_ep); =20 - if (bnx2i_map_ep_dbell_regs(bnx2i_ep)) + rc =3D bnx2i_map_ep_dbell_regs(bnx2i_ep); + if (rc) goto del_active_ep; =20 mutex_unlock(&hba->net_dev_lock); --=20 2.15.1