Skip to content

Commit 6f808bd

Browse files
jsmart-ghmartinkpetersen
authored andcommitted
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: bb21fc9 ("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]>
1 parent e27f051 commit 6f808bd

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/scsi/lpfc/lpfc_scsi.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6062,6 +6062,9 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd)
60626062
int status;
60636063
u32 logit = LOG_FCP;
60646064

6065+
if (!rport)
6066+
return FAILED;
6067+
60656068
rdata = rport->dd_data;
60666069
if (!rdata || !rdata->pnode) {
60676070
lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
@@ -6140,6 +6143,9 @@ lpfc_target_reset_handler(struct scsi_cmnd *cmnd)
61406143
unsigned long flags;
61416144
DECLARE_WAIT_QUEUE_HEAD_ONSTACK(waitq);
61426145

6146+
if (!rport)
6147+
return FAILED;
6148+
61436149
rdata = rport->dd_data;
61446150
if (!rdata || !rdata->pnode) {
61456151
lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,

0 commit comments

Comments
 (0)