Commit 00eca153 authored by Shreyas Deodhar's avatar Shreyas Deodhar Committed by Martin K. Petersen

scsi: qla2xxx: Pointer may be dereferenced

Klocwork tool reported pointer 'rport' returned from call to function
fc_bsg_to_rport() may be NULL and will be dereferenced.

Add a fix to validate rport before dereferencing.

Cc: stable@vger.kernel.org
Signed-off-by: default avatarShreyas Deodhar <sdeodhar@marvell.com>
Signed-off-by: default avatarNilesh Javali <njavali@marvell.com>
Link: https://lore.kernel.org/r/20230607113843.37185-7-njavali@marvell.comReviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent b68710a8
...@@ -2996,6 +2996,8 @@ qla24xx_bsg_request(struct bsg_job *bsg_job) ...@@ -2996,6 +2996,8 @@ qla24xx_bsg_request(struct bsg_job *bsg_job)
if (bsg_request->msgcode == FC_BSG_RPT_ELS) { if (bsg_request->msgcode == FC_BSG_RPT_ELS) {
rport = fc_bsg_to_rport(bsg_job); rport = fc_bsg_to_rport(bsg_job);
if (!rport)
return ret;
host = rport_to_shost(rport); host = rport_to_shost(rport);
vha = shost_priv(host); vha = shost_priv(host);
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment