Skip to content

Commit ff2b46d

Browse files
dinghaoliuwilldeacon
authored andcommitted
iommu/intel: Fix memleak in intel_irq_remapping_alloc
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: b106ee6 ("irq_remapping/vt-d: Enhance Intel IR driver to support hierarchical irqdomains") Signed-off-by: Dinghao Liu <[email protected]> Acked-by: Lu Baolu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 6775ae9 commit ff2b46d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/iommu/intel/irq_remapping.c

+2
Original file line numberDiff line numberDiff line change
@@ -1353,6 +1353,8 @@ static int intel_irq_remapping_alloc(struct irq_domain *domain,
13531353
irq_data = irq_domain_get_irq_data(domain, virq + i);
13541354
irq_cfg = irqd_cfg(irq_data);
13551355
if (!irq_data || !irq_cfg) {
1356+
if (!i)
1357+
kfree(data);
13561358
ret = -EINVAL;
13571359
goto out_free_data;
13581360
}

0 commit comments

Comments
 (0)