summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorNilesh Javali <njavali@marvell.com>2023-06-07 17:08:38 +0530
committerMartin K. Petersen <martin.petersen@oracle.com>2023-06-14 22:06:01 -0400
commit6b504d06976fe4a61cc05dedc68b84fadb397f77 (patch)
tree6a8412a3475fa719bbf8413d0fb558868b6a1d84 /drivers
parent464ea494a40c6e3e0e8f91dd325408aaf21515ba (diff)
downloadlinux-stable-6b504d06976fe4a61cc05dedc68b84fadb397f77.tar.gz
linux-stable-6b504d06976fe4a61cc05dedc68b84fadb397f77.tar.bz2
linux-stable-6b504d06976fe4a61cc05dedc68b84fadb397f77.zip
scsi: qla2xxx: Avoid fcport pointer dereference
Klocwork reported warning of NULL pointer may be dereferenced. The routine exits when sa_ctl is NULL and fcport is allocated after the exit call thus causing NULL fcport pointer to dereference at the time of exit. To avoid fcport pointer dereference, exit the routine when sa_ctl is NULL. Cc: stable@vger.kernel.org Signed-off-by: Nilesh Javali <njavali@marvell.com> Link: https://lore.kernel.org/r/20230607113843.37185-4-njavali@marvell.com Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/qla2xxx/qla_edif.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/scsi/qla2xxx/qla_edif.c b/drivers/scsi/qla2xxx/qla_edif.c
index ec0e20255bd3..26e6b3e3af43 100644
--- a/drivers/scsi/qla2xxx/qla_edif.c
+++ b/drivers/scsi/qla2xxx/qla_edif.c
@@ -2361,8 +2361,8 @@ qla24xx_issue_sa_replace_iocb(scsi_qla_host_t *vha, struct qla_work_evt *e)
if (!sa_ctl) {
ql_dbg(ql_dbg_edif, vha, 0x70e6,
"sa_ctl allocation failed\n");
- rval = -ENOMEM;
- goto done;
+ rval = -ENOMEM;
+ return rval;
}
fcport = sa_ctl->fcport;