[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ca8f9997-4310-710e-07a5-e2f0be57e916@linux.intel.com>
Date: Tue, 5 Jan 2021 16:38:04 +0800
From: Lu Baolu <baolu.lu@...ux.intel.com>
To: Dinghao Liu <dinghao.liu@....edu.cn>, kjlu@....edu
Cc: baolu.lu@...ux.intel.com, David Woodhouse <dwmw2@...radead.org>,
Joerg Roedel <joro@...tes.org>, Will Deacon <will@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Jiang Liu <jiang.liu@...ux.intel.com>,
iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] [v2] iommu/intel: Fix memleak in
intel_irq_remapping_alloc
On 2021/1/5 13:18, Dinghao Liu wrote:
> When irq_domain_get_irq_data() or irqd_cfg() fails
> at i == 0, data allocated by kzalloc() has not been
> freed before returning, which leads to memleak.
>
> Fixes: b106ee63abccb ("irq_remapping/vt-d: Enhance Intel IR driver to support hierarchical irqdomains")
> Signed-off-by: Dinghao Liu <dinghao.liu@....edu.cn>
Acked-by: Lu Baolu <baolu.lu@...ux.intel.com>
Best regards,
baolu
> ---
>
> Changelog:
>
> v2: - Add a check against i instead of setting data to NULL.
> ---
> drivers/iommu/intel/irq_remapping.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/iommu/intel/irq_remapping.c b/drivers/iommu/intel/irq_remapping.c
> index aeffda92b10b..685200a5cff0 100644
> --- a/drivers/iommu/intel/irq_remapping.c
> +++ b/drivers/iommu/intel/irq_remapping.c
> @@ -1353,6 +1353,8 @@ static int intel_irq_remapping_alloc(struct irq_domain *domain,
> irq_data = irq_domain_get_irq_data(domain, virq + i);
> irq_cfg = irqd_cfg(irq_data);
> if (!irq_data || !irq_cfg) {
> + if (!i)
> + kfree(data);
> ret = -EINVAL;
> goto out_free_data;
> }
>
Powered by blists - more mailing lists