diff options
author | James Smart <[email protected]> | 2022-06-03 10:43:24 -0700 |
---|---|---|
committer | Martin K. Petersen <[email protected]> | 2022-06-07 21:38:17 -0400 |
commit | 6f808bd78e8296b4ded813b7182988d57e1f6176 (patch) | |
tree | 740cf302a6572bf88cc7da3f7a3d32a1be742835 | |
parent | e27f05147bff21408c1b8410ad8e90cd286e7952 (diff) |
scsi: lpfc: Address NULL pointer dereference after starget_to_rport()
Calls to starget_to_rport() may return NULL. Add check for NULL rport
before dereference.
Link: https://lore.kernel.org/r/[email protected]
Fixes: bb21fc9911ee ("scsi: lpfc: Use fc_block_rport()")
Cc: <[email protected]> # v5.18
Co-developed-by: Justin Tee <[email protected]>
Signed-off-by: Justin Tee <[email protected]>
Signed-off-by: James Smart <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
-rw-r--r-- | drivers/scsi/lpfc/lpfc_scsi.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index d43968203248..ba5e4016262e 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -6062,6 +6062,9 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd) int status; u32 logit = LOG_FCP; + if (!rport) + return FAILED; + rdata = rport->dd_data; if (!rdata || !rdata->pnode) { lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, @@ -6140,6 +6143,9 @@ lpfc_target_reset_handler(struct scsi_cmnd *cmnd) unsigned long flags; DECLARE_WAIT_QUEUE_HEAD_ONSTACK(waitq); + if (!rport) + return FAILED; + rdata = rport->dd_data; if (!rdata || !rdata->pnode) { lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, |