forked from luck/tmp_suning_uos_patched
scsi: hisi_sas: Drop free_irq() of devm_request_irq() allocated irq
[ Upstream commit 7907a021e4bbfa29cccacd2ba2dade894d9a7d4c ] 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/20210519130519.2661938-1-yangyingliang@huawei.com Reported-by: Hulk Robot <hulkci@huawei.com> Acked-by: John Garry <john.garry@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
eac1d159b7
commit
1676363528
|
@ -3359,14 +3359,14 @@ hisi_sas_v3_destroy_irqs(struct pci_dev *pdev, struct hisi_hba *hisi_hba)
|
|||
{
|
||||
int i;
|
||||
|
||||
free_irq(pci_irq_vector(pdev, 1), hisi_hba);
|
||||
free_irq(pci_irq_vector(pdev, 2), hisi_hba);
|
||||
free_irq(pci_irq_vector(pdev, 11), hisi_hba);
|
||||
devm_free_irq(&pdev->dev, pci_irq_vector(pdev, 1), hisi_hba);
|
||||
devm_free_irq(&pdev->dev, pci_irq_vector(pdev, 2), hisi_hba);
|
||||
devm_free_irq(&pdev->dev, pci_irq_vector(pdev, 11), hisi_hba);
|
||||
for (i = 0; i < hisi_hba->cq_nvecs; i++) {
|
||||
struct hisi_sas_cq *cq = &hisi_hba->cq[i];
|
||||
int nr = hisi_sas_intr_conv ? 16 : 16 + i;
|
||||
|
||||
free_irq(pci_irq_vector(pdev, nr), cq);
|
||||
devm_free_irq(&pdev->dev, pci_irq_vector(pdev, nr), cq);
|
||||
}
|
||||
pci_free_irq_vectors(pdev);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user