Skip to contentSkip to conversation

scsi: initio: free SCB array on remove

PATCH New Guangshuo Li 1 participant 1 message Sep 18

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: initio: free SCB array on remove

initio_probe_one() allocates an SCB array and stores it in host->scb. The probe failure paths free this array, but the normal remove path does not perform the corresponding cleanup.

As a result, the SCB array remains allocated after the driver is removed and becomes unreachable once the SCSI host is released.

Free the SCB array in initio_remove_one(), matching the probe error path.

This issue was found by manual code inspection.

Fixes 72d39fea9017 ("[SCSI] initio: Convert into a real Linux driver and update to modern style")
---
 drivers/scsi/initio.c | 1 +
 1 file changed, 1 insertion(+)
drivers/scsi/initio.c +1 -0
index 06fbe85dccfa..b373828bddf1 100644
@@ -2934,6 +2934,7 @@ static void initio_remove_one(struct pci_dev *pdev)
 	struct initio_host *s = (struct initio_host *)host->hostdata;
 	scsi_remove_host(host);
 	free_irq(pdev->irq, host);
+	kfree(s->scb);
 	release_region(s->addr, 256);
 	scsi_host_put(host);
 	pci_disable_device(pdev);
Signature · 1 line
2.43.0