mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-08 18:35:20 +02:00
scsi: elx: libefc: Fix potential use after free in efc_nport_vport_del()
[ Upstream commit2e4b02fad0
] The kref_put() function will call nport->release if the refcount drops to zero. The nport->release release function is _efc_nport_free() which frees "nport". But then we dereference "nport" on the next line which is a use after free. Re-order these lines to avoid the use after free. Fixes:fcd427303e
("scsi: elx: libefc: SLI and FC PORT state machine interfaces") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/b666ab26-6581-4213-9a3d-32a9147f0399@stanley.mountain Reviewed-by: Daniel Wagner <dwagner@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
9263023a0b
commit
baeb8628ab
|
@ -705,9 +705,9 @@ efc_nport_vport_del(struct efc *efc, struct efc_domain *domain,
|
|||
spin_lock_irqsave(&efc->lock, flags);
|
||||
list_for_each_entry(nport, &domain->nport_list, list_entry) {
|
||||
if (nport->wwpn == wwpn && nport->wwnn == wwnn) {
|
||||
kref_put(&nport->ref, nport->release);
|
||||
/* Shutdown this NPORT */
|
||||
efc_sm_post_event(&nport->sm, EFC_EVT_SHUTDOWN, NULL);
|
||||
kref_put(&nport->ref, nport->release);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user