diff options
author | Dinghao Liu <dinghao.liu@zju.edu.cn> | 2021-01-05 08:18:37 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-01-17 16:17:03 +0300 |
commit | 2a21faa9c5961cafe13e12fb32ec2796c6c1329c (patch) | |
tree | eae4743ffe9c83aecfd1f7514dde0876dd74d5cd /drivers/iommu | |
parent | 39b3204e54c18fe32663e7c9525b52d30419b717 (diff) | |
download | linux-2a21faa9c5961cafe13e12fb32ec2796c6c1329c.tar.xz |
iommu/intel: Fix memleak in intel_irq_remapping_alloc
commit ff2b46d7cff80d27d82f7f3252711f4ca1666129 upstream.
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: b106ee63abcc ("irq_remapping/vt-d: Enhance Intel IR driver to support hierarchical irqdomains")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Acked-by: Lu Baolu <baolu.lu@linux.intel.com>
Link: https://lore.kernel.org/r/20210105051837.32118-1-dinghao.liu@zju.edu.cn
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/iommu')
-rw-r--r-- | drivers/iommu/intel/irq_remapping.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/iommu/intel/irq_remapping.c b/drivers/iommu/intel/irq_remapping.c index 0cfce1d3b7bb..aedaae4630bc 100644 --- a/drivers/iommu/intel/irq_remapping.c +++ b/drivers/iommu/intel/irq_remapping.c @@ -1390,6 +1390,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; } |