Skip to content

Commit

Permalink
scsi: qla2xxx: Check valid rport returned by fc_bsg_to_rport()
Browse files Browse the repository at this point in the history
Klocwork reported warning of rport maybe NULL and will be dereferenced.
rport returned by call to fc_bsg_to_rport() could be NULL and dereferenced.

Check valid rport returned by fc_bsg_to_rport().

Cc: stable@vger.kernel.org
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Link: https://lore.kernel.org/r/20230607113843.37185-5-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Nilesh Javali authored and Martin K. Petersen committed Jun 15, 2023
1 parent 6b504d0 commit af73f23
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/scsi/qla2xxx/qla_bsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@ qla2x00_process_els(struct bsg_job *bsg_job)

if (bsg_request->msgcode == FC_BSG_RPT_ELS) {
rport = fc_bsg_to_rport(bsg_job);
if (!rport) {
rval = -ENOMEM;
goto done;
}
fcport = *(fc_port_t **) rport->dd_data;
host = rport_to_shost(rport);
vha = shost_priv(host);
Expand Down

0 comments on commit af73f23

Please sign in to comment.