lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 18 May 2021 16:34:24 +0100
From:   John Garry <john.garry@...wei.com>
To:     Yang Yingliang <yangyingliang@...wei.com>,
        <linux-kernel@...r.kernel.org>, <linux-scsi@...r.kernel.org>
CC:     <jejb@...ux.ibm.com>, <martin.petersen@...cle.com>,
        chenxiang <chenxiang66@...ilicon.com>,
        "luojiaxing@...wei.com" <luojiaxing@...wei.com>
Subject: Re: [PATCH -next] scsi: hisi_sas: drop free_irq of devm_request_irq
 allocated irq

On 18/05/2021 14:09, Yang Yingliang wrote:
> irq allocated with devm_request_irq should not be freed using
> free_irq, because doing so causes a dangling pointer, and a
> subsequent double free.
> 
> Reported-by: Hulk Robot <hulkci@...wei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
> ---
>   drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
> index 499c770d405c..684f762bcfb3 100644
> --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
> +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
> @@ -4811,9 +4811,9 @@ 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;
> 

Does the free_irq(pci_irq_vector(pdev, nr, cq)) call also need to change 
(not shown)?

Having said that, why have these at all if we use devm_request_irq()? 
devm_irq_release() calls free_irq().

Thanks,
John

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ