[PATCH] scsi: pmcraid: decrement adapter count on remove
From: Guangshuo Li
Date: Fri Sep 18 2026 - 13:36:25 EST
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")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Guangshuo Li <lgs201920130244@xxxxxxxxx>
---
drivers/scsi/pmcraid.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index 942a99393204..da80f1d39ec4 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -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;
--
2.43.0