summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKangjie Lu <kjlu@umn.edu>2019-03-14 09:30:59 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-04 10:20:20 +0300
commit4135e588274e7b8ddeea95683f9d70f19d019f2e (patch)
tree0321ac6a6cabfded55f7fc773634a7bff0c1af3d
parenta2b302e4f2fb40bdcda3c7c70dae9a27974dbd49 (diff)
downloadlinux-4135e588274e7b8ddeea95683f9d70f19d019f2e.tar.xz
scsi: qla4xxx: fix a potential NULL pointer dereference
[ Upstream commit fba1bdd2a9a93f3e2181ec1936a3c2f6b37e7ed6 ] In case iscsi_lookup_endpoint fails, the fix returns -EINVAL to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu <kjlu@umn.edu> Acked-by: Manish Rangankar <mrangankar@marvell.com> Reviewed-by: Mukesh Ojha <mojha@codeaurora.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Sasha Levin (Microsoft) <sashal@kernel.org>
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 575445c761b4..5dd3e4e01b10 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -3204,6 +3204,8 @@ static int qla4xxx_conn_bind(struct iscsi_cls_session *cls_session,
if (iscsi_conn_bind(cls_session, cls_conn, is_leading))
return -EINVAL;
ep = iscsi_lookup_endpoint(transport_fd);
+ if (!ep)
+ return -EINVAL;
conn = cls_conn->dd_data;
qla_conn = conn->dd_data;
qla_conn->qla_ep = ep->dd_data;