Skip to content

Commit

Permalink
scsi: qla2xxx: Pointer may be dereferenced
Browse files Browse the repository at this point in the history
commit 00eca15 upstream.

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: Shreyas Deodhar <sdeodhar@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Link: https://lore.kernel.org/r/20230607113843.37185-7-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Shreyas Deodhar authored and Fishwaldo committed Aug 20, 2023
1 parent 23efa9f commit 05ee376
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/scsi/qla2xxx/qla_bsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2903,6 +2903,8 @@ qla24xx_bsg_request(struct bsg_job *bsg_job)

if (bsg_request->msgcode == FC_BSG_RPT_ELS) {
rport = fc_bsg_to_rport(bsg_job);
if (!rport)
return ret;
host = rport_to_shost(rport);
vha = shost_priv(host);
} else {
Expand Down

0 comments on commit 05ee376

Please sign in to comment.