mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guangshuo Li <lgs201920130244@gmail.com>
To: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Anil Ravindranath <anil_ravindranath@pmc-sierra.com>,
	James Bottomley <James.Bottomley@suse.de>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Guangshuo Li <lgs201920130244@gmail.com>, stable@vger.kernel.org
Subject: [PATCH] scsi: pmcraid: decrement adapter count on remove
Date: Sat, 19 Sep 2026 01:25:41 +0800	[thread overview]
Message-ID: <20260918172541.3599902-1-lgs201920130244@gmail.com> (raw)

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@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
 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


                 reply	other threads:[~2026-09-18 17:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260918172541.3599902-1-lgs201920130244@gmail.com \
    --to=lgs201920130244@gmail.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=James.Bottomley@suse.de \
    --cc=anil_ravindranath@pmc-sierra.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®