Linux SCSI subsystem development
 help / color / mirror / Atom feed
* [PATCH] scsi: pm8001: fix IRQ leak using wrong index in MSI-X error path
@ 2026-08-28 11:17 Peng Hao
  2026-08-28 11:34 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Peng Hao @ 2026-08-28 11:17 UTC (permalink / raw)
  To: jinpu.wang, James.Bottomley; +Cc: linux-scsi

pm8001_request_msix() requests each MSI-X IRQ with the loop index i. On a
request_irq() failure the cleanup loop "for (j = 0; j < i; j++)" calls
free_irq() with pci_irq_vector(pdev, i) and &irq_vector[i], i.e. the failed
index i instead of j. It therefore repeatedly tries to free the IRQ i that
was never successfully requested (triggering a free_irq() warning) while
the successfully requested IRQs 0..i-1 are never freed (leaked). Use j.

Fixes: 6cd60b37f72b ("[SCSI] pm80xx: Tasklets synchronization fix.")
Signed-off-by: Peng Hao <flyingpeng@tencent.com>
---
 drivers/scsi/pm8001/pm8001_init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c
index e93ea76b565e..54b35893261a 100644
--- a/drivers/scsi/pm8001/pm8001_init.c
+++ b/drivers/scsi/pm8001/pm8001_init.c
@@ -1029,8 +1029,8 @@ static u32 pm8001_request_msix(struct pm8001_hba_info *pm8001_ha)
 			&(pm8001_ha->irq_vector[i]));
 		if (rc) {
 			for (j = 0; j < i; j++) {
-				free_irq(pci_irq_vector(pm8001_ha->pdev, i),
-					&(pm8001_ha->irq_vector[i]));
+				free_irq(pci_irq_vector(pm8001_ha->pdev, j),
+					 &pm8001_ha->irq_vector[j]);
 			}
 			pci_free_irq_vectors(pm8001_ha->pdev);
 			break;
-- 
2.43.7


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-28 11:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-28 11:17 [PATCH] scsi: pm8001: fix IRQ leak using wrong index in MSI-X error path Peng Hao
2026-08-28 11:34 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox