From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-dm3nam03on0114.outbound.protection.outlook.com ([104.47.41.114]:52647 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756123AbeDIAai (ORCPT ); Sun, 8 Apr 2018 20:30:38 -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 4.9 148/293] scsi: bnx2i: missing error code in bnx2i_ep_connect() Date: Mon, 9 Apr 2018 00:24:49 +0000 Message-ID: <20180409002239.163177-148-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-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 133901fd3e35..24c920d3ffb2 100644 --- a/drivers/scsi/bnx2i/bnx2i_iscsi.c +++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c @@ -1909,7 +1909,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