mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scsi: pm8001: use rollback index when freeing MSI-X vectors
@ 2026-08-24 11:36 Runyu Xiao
  2026-08-28 11:30 ` Jinpu Wang
  2026-08-29  1:36 ` Martin K. Petersen (Oracle)
  0 siblings, 2 replies; 3+ messages in thread
From: Runyu Xiao @ 2026-08-24 11:36 UTC (permalink / raw)
  To: Jack Wang
  Cc: James E . J . Bottomley, Martin K . Petersen, linux-scsi,
	linux-kernel, stable, Runyu Xiao, Jianhao Xu

pm8001_request_msix() unwinds previously registered handlers with
free_irq() when request_irq() fails. The rollback loop uses the
failing index i for every iteration instead of the already
registered vector index j.

That passes the wrong IRQ/dev_id pair to free_irq() and leaves the
earlier handlers installed. Use j for both pci_irq_vector() and the
matching irq_vector entry in the rollback loop.

Fixes: a76037ff3479 ("scsi: pm8001: switch to pci_irq_alloc_vectors")
Cc: stable@vger.kernel.org
Assisted-by: Codex:GPT-5
Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
---
 drivers/scsi/pm8001/pm8001_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c
index e93ea76b565e..21419e46c16d 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.34.1

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

* Re: [PATCH] scsi: pm8001: use rollback index when freeing MSI-X vectors
  2026-08-24 11:36 [PATCH] scsi: pm8001: use rollback index when freeing MSI-X vectors Runyu Xiao
@ 2026-08-28 11:30 ` Jinpu Wang
  2026-08-29  1:36 ` Martin K. Petersen (Oracle)
  1 sibling, 0 replies; 3+ messages in thread
From: Jinpu Wang @ 2026-08-28 11:30 UTC (permalink / raw)
  To: Runyu Xiao
  Cc: James E . J . Bottomley, Martin K . Petersen, linux-scsi,
	linux-kernel, stable, Jianhao Xu

On Mon, Aug 24, 2026 at 1:36 PM Runyu Xiao <runyu.xiao@seu.edu.cn> wrote:
>
> pm8001_request_msix() unwinds previously registered handlers with
> free_irq() when request_irq() fails. The rollback loop uses the
> failing index i for every iteration instead of the already
> registered vector index j.
>
> That passes the wrong IRQ/dev_id pair to free_irq() and leaves the
> earlier handlers installed. Use j for both pci_irq_vector() and the
> matching irq_vector entry in the rollback loop.
>
> Fixes: a76037ff3479 ("scsi: pm8001: switch to pci_irq_alloc_vectors")
> Cc: stable@vger.kernel.org
> Assisted-by: Codex:GPT-5
> Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
Acked-by: Jack Wang <jinpu.wang@cloud.ionos.com>
> ---
>  drivers/scsi/pm8001/pm8001_init.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c
> index e93ea76b565e..21419e46c16d 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.34.1

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

* Re: [PATCH] scsi: pm8001: use rollback index when freeing MSI-X vectors
  2026-08-24 11:36 [PATCH] scsi: pm8001: use rollback index when freeing MSI-X vectors Runyu Xiao
  2026-08-28 11:30 ` Jinpu Wang
@ 2026-08-29  1:36 ` Martin K. Petersen (Oracle)
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen (Oracle) @ 2026-08-29  1:36 UTC (permalink / raw)
  To: Runyu Xiao
  Cc: Jack Wang, James E . J . Bottomley, Martin K . Petersen,
	linux-scsi, linux-kernel, stable, Jianhao Xu


Runyu,

> pm8001_request_msix() unwinds previously registered handlers with
> free_irq() when request_irq() fails. The rollback loop uses the
> failing index i for every iteration instead of the already registered
> vector index j.
>
> That passes the wrong IRQ/dev_id pair to free_irq() and leaves the
> earlier handlers installed. Use j for both pci_irq_vector() and the
> matching irq_vector entry in the rollback loop.

Applied to 7.3/scsi-staging, thanks!

-- 
Martin K. Petersen

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

end of thread, other threads:[~2026-08-29  1:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-24 11:36 [PATCH] scsi: pm8001: use rollback index when freeing MSI-X vectors Runyu Xiao
2026-08-28 11:30 ` Jinpu Wang
2026-08-29  1:36 ` Martin K. Petersen (Oracle)

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®