Skip to contentSkip to conversation

scsi: pmcraid: decrement adapter count on remove

PATCH New Guangshuo Li 1 participant 1 message Sep 18

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

PATCH 1/1 scsi: pmcraid: decrement adapter count on remove

pmcraid_probe() increments pmcraid_adapter_count when an adapter is being initialized. All probe failure paths decrement the count again, but the normal remove path does not perform the corresponding cleanup.

As a result, the adapter count remains incremented after a device is removed. Repeated bind and unbind cycles can eventually make the count reach PMCRAID_MAX_ADAPTERS and prevent otherwise valid adapters from being probed.

Decrement pmcraid_adapter_count in pmcraid_remove(), matching the probe error path.

This issue was found by manual code inspection.

Fixes 89a368104150 ("[SCSI] pmcraid: PMC-Sierra MaxRAID driver to support 6Gb/s SAS RAID controller")
---
 drivers/scsi/pmcraid.c | 1 +
 1 file changed, 1 insertion(+)
drivers/scsi/pmcraid.c +1 -0
index 942a99393204..da80f1d39ec4 100644
@@ -4778,6 +4778,7 @@ static void pmcraid_remove(struct pci_dev *pdev)
 	iounmap(pinstance->mapped_dma_addr);
 	pci_release_regions(pdev);
 	scsi_host_put(pinstance->host);
+	atomic_dec(&pmcraid_adapter_count);
 	pci_disable_device(pdev);
 
 	return;
Signature · 1 line
2.43.0