[PATCH] scsi: bvme6000: put SCSI host on remove

Guangshuo Li posted 1 patch 6 days, 18 hours ago
drivers/scsi/bvme6000_scsi.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] scsi: bvme6000: put SCSI host on remove
Posted by Guangshuo Li 6 days, 18 hours ago
bvme6000_probe() obtains a SCSI host through NCR_700_detect(). The
probe failure path drops the host reference with scsi_host_put(), but
the normal remove path does not perform the corresponding cleanup.

As a result, the SCSI host reference remains allocated after the
driver is removed.

Call scsi_host_put() after the IRQ has been released to drop the host
reference acquired during probe.

This issue was found by manual code inspection.

Fixes: 8276b58af4dd ("[SCSI] 53c700: m68k BVME6000 NCR53C710 SCSI")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
 drivers/scsi/bvme6000_scsi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/bvme6000_scsi.c b/drivers/scsi/bvme6000_scsi.c
index 23301edf100d..0beb4a2e5a23 100644
--- a/drivers/scsi/bvme6000_scsi.c
+++ b/drivers/scsi/bvme6000_scsi.c
@@ -99,6 +99,7 @@ bvme6000_device_remove(struct platform_device *dev)
 	NCR_700_release(host);
 	kfree(hostdata);
 	free_irq(host->irq, host);
+	scsi_host_put(host);
 }
 
 static struct platform_driver bvme6000_scsi_driver = {
-- 
2.43.0