Skip to content

Commit 7907a02

Browse files
Yang Yingliangmartinkpetersen
authored andcommitted
scsi: hisi_sas: Drop free_irq() of devm_request_irq() allocated irq
irqs allocated with devm_request_irq() should not be freed using free_irq(). Doing so causes a dangling pointer and a subsequent double free. Link: https://lore.kernel.org/r/[email protected] Reported-by: Hulk Robot <[email protected]> Acked-by: John Garry <[email protected]> Signed-off-by: Yang Yingliang <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent e662502 commit 7907a02

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/scsi/hisi_sas/hisi_sas_v3_hw.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4811,14 +4811,14 @@ hisi_sas_v3_destroy_irqs(struct pci_dev *pdev, struct hisi_hba *hisi_hba)
48114811
{
48124812
int i;
48134813

4814-
free_irq(pci_irq_vector(pdev, 1), hisi_hba);
4815-
free_irq(pci_irq_vector(pdev, 2), hisi_hba);
4816-
free_irq(pci_irq_vector(pdev, 11), hisi_hba);
4814+
devm_free_irq(&pdev->dev, pci_irq_vector(pdev, 1), hisi_hba);
4815+
devm_free_irq(&pdev->dev, pci_irq_vector(pdev, 2), hisi_hba);
4816+
devm_free_irq(&pdev->dev, pci_irq_vector(pdev, 11), hisi_hba);
48174817
for (i = 0; i < hisi_hba->cq_nvecs; i++) {
48184818
struct hisi_sas_cq *cq = &hisi_hba->cq[i];
48194819
int nr = hisi_sas_intr_conv ? 16 : 16 + i;
48204820

4821-
free_irq(pci_irq_vector(pdev, nr), cq);
4821+
devm_free_irq(&pdev->dev, pci_irq_vector(pdev, nr), cq);
48224822
}
48234823
pci_free_irq_vectors(pdev);
48244824
}

0 commit comments

Comments
 (0)