Skip to content

Commit 9c30349

Browse files
Justin Teemartinkpetersen
authored andcommitted
scsi: lpfc: Early return after marking final NLP_DROPPED flag in dev_loss_tmo
When a dev_loss_tmo event occurs, an ndlp lock is taken before checking nlp_flag for NLP_DROPPED. There is an attempt to restore the ndlp lock when exiting the if statement, but the nlp_put kref could be the final decrement causing a use-after-free memory access on a released ndlp object. Instead of trying to reacquire the ndlp lock after checking nlp_flag, just return after calling nlp_put. Signed-off-by: Justin Tee <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: "Ewan D. Milne" <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 7dcc683 commit 9c30349

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/scsi/lpfc/lpfc_hbadisc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport)
203203
ndlp->nlp_flag |= NLP_DROPPED;
204204
spin_unlock_irqrestore(&ndlp->lock, iflags);
205205
lpfc_nlp_put(ndlp);
206-
spin_lock_irqsave(&ndlp->lock, iflags);
206+
return;
207207
}
208208

209209
spin_unlock_irqrestore(&ndlp->lock, iflags);

0 commit comments

Comments
 (0)