[PATCH] scsi: myrs: Fix scsi_device reference leak in myrs_log_event()
From: Wentao Liang
Date: Thu Sep 17 2026 - 11:36:09 EST
scsi_device_lookup() returns a scsi_device with an extra reference
that the caller has to drop with scsi_device_put(). The physical device
event handler never releases it, so the scsi_device reference is leaked
for every physical device event reported by the controller.
Drop the reference after the device state has been updated.
Fixes: 77266186397c ("scsi: myrs: Add Mylex RAID controller (SCSI interface)")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
---
drivers/scsi/myrs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/scsi/myrs.c b/drivers/scsi/myrs.c
index afd68225221a..79ee3a352524 100644
--- a/drivers/scsi/myrs.c
+++ b/drivers/scsi/myrs.c
@@ -875,6 +875,8 @@ static void myrs_log_event(struct myrs_hba *cs, struct myrs_event *ev)
break;
}
}
+ if (sdev)
+ scsi_device_put(sdev);
break;
case 'L':
shost_printk(KERN_INFO, shost,
--
2.34.1