1 From 22ba4acc3cef0061d77cc01b18a82140b3d8c9f8 Mon Sep 17 00:00:00 2001
2 From: Kangjie Lu <kjlu@umn.edu>
3 Date: Thu, 14 Mar 2019 01:30:59 -0500
4 Subject: scsi: qla4xxx: fix a potential NULL pointer dereference
6 [ Upstream commit fba1bdd2a9a93f3e2181ec1936a3c2f6b37e7ed6 ]
8 In case iscsi_lookup_endpoint fails, the fix returns -EINVAL to avoid NULL
11 Signed-off-by: Kangjie Lu <kjlu@umn.edu>
12 Acked-by: Manish Rangankar <mrangankar@marvell.com>
13 Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
14 Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
15 Signed-off-by: Sasha Levin (Microsoft) <sashal@kernel.org>
17 drivers/scsi/qla4xxx/ql4_os.c | 2 ++
18 1 file changed, 2 insertions(+)
20 diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
21 index f9f899ec9427..c158967b59d7 100644
22 --- a/drivers/scsi/qla4xxx/ql4_os.c
23 +++ b/drivers/scsi/qla4xxx/ql4_os.c
24 @@ -3207,6 +3207,8 @@ static int qla4xxx_conn_bind(struct iscsi_cls_session *cls_session,
25 if (iscsi_conn_bind(cls_session, cls_conn, is_leading))
27 ep = iscsi_lookup_endpoint(transport_fd);
30 conn = cls_conn->dd_data;
31 qla_conn = conn->dd_data;
32 qla_conn->qla_ep = ep->dd_data;