[PATCH] scsi: aic7xxx: Fix scsi_device reference leak in ahc_dump_target_state()

From: Wentao Liang

Date: Thu Sep 17 2026 - 10:48:26 EST


ahc_dump_target_state() looks up each LUN with
scsi_device_lookup_by_target(), which returns the device with a
reference held, but the reference is never dropped. Put the device once
its state has been dumped.

Fixes: 9080063f523b ("[SCSI] aic7xxx: Remove slave_destroy")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
---
drivers/scsi/aic7xxx/aic7xxx_proc.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/aic7xxx/aic7xxx_proc.c b/drivers/scsi/aic7xxx/aic7xxx_proc.c
index 3b2ba7b4d61b..59d1bfe51351 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_proc.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_proc.c
@@ -165,6 +165,7 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct seq_file *m,
continue;

ahc_dump_device_state(m, sdev);
+ scsi_device_put(sdev);
}
}

--
2.34.1