Skip to content

Commit

Permalink
scsi: qla2xxx: Pointer may be dereferenced
Browse files Browse the repository at this point in the history
commit 00eca15319d9ce8c31cdf22f32a3467775423df4 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: [email protected]
Signed-off-by: Shreyas Deodhar <[email protected]>
Signed-off-by: Nilesh Javali <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Himanshu Madhani <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Shreyas Deodhar authored and gregkh committed Jul 23, 2023
1 parent 541af83 commit 0715da5
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 0715da5

Please sign in to comment.