[PATCH] scsi: mpt3sas: Fix sas_device reference leak in _scsih_update_vphys_after_reset()
From: Wentao Liang
Date: Thu Sep 17 2026 - 13:31:25 EST
mpt3sas_get_sdev_by_addr() takes a reference on the sas device, but the
new hba_port pointer is merely stored in sas_device->port, so the
reference is never released. The sas device is thus leaked every time
a vSES device moves to another Port ID after a reset.
Drop the extra reference once the port pointer has been updated.
Fixes: ffa381d6373b ("scsi: mpt3sas: Handle vSES vphy object during HBA reset")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
---
drivers/scsi/mpt3sas/mpt3sas_scsih.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index c841fe1706c7..550a5e4fec10 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -6415,8 +6415,10 @@ _scsih_update_vphys_after_reset(struct MPT3SAS_ADAPTER *ioc)
&mport->vphys_list);
sas_device = mpt3sas_get_sdev_by_addr(
ioc, attached_sas_addr, port);
- if (sas_device)
+ if (sas_device) {
sas_device->port = mport;
+ sas_device_put(sas_device);
+ }
}
/*
* Earlier while updating the hba_port table,
--
2.34.1