Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0e1e367a authored by Thomas Gleixner's avatar Thomas Gleixner
Browse files

pci: intr-remap: Free irte memory if SPARSE_IRQ=y



With SPARSE_IRQ=y the irte descriptors are dynamically allocated, but not
freed in free_irte().

That was ok as long as the sparse irq core was not freeing irq descriptors on
destroy_irq(). Now we leak the irte descriptor. Free it in free_irte().

Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarIngo Molnar <mingo@elte.hu>
Acked-by: default avatarSuresh Siddha <suresh.b.siddha@intel.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
parent bc5fdf9f
Loading
Loading
Loading
Loading
+14 −0
Original line number Original line Diff line number Diff line
@@ -95,6 +95,15 @@ static struct irq_2_iommu *irq_2_iommu_alloc(unsigned int irq)
	return desc->irq_2_iommu;
	return desc->irq_2_iommu;
}
}


static void irq_2_iommu_free(unsigned int irq)
{
	struct irq_data *d = irq_get_irq_data(irq);
	struct irq_2_iommu *p = d->irq_2_iommu;

	d->irq_2_iommu = NULL;
	kfree(p);
}

#else /* !CONFIG_SPARSE_IRQ */
#else /* !CONFIG_SPARSE_IRQ */


static struct irq_2_iommu irq_2_iommuX[NR_IRQS];
static struct irq_2_iommu irq_2_iommuX[NR_IRQS];
@@ -110,6 +119,9 @@ static struct irq_2_iommu *irq_2_iommu_alloc(unsigned int irq)
{
{
	return irq_2_iommu(irq);
	return irq_2_iommu(irq);
}
}

static void irq_2_iommu_free(unsigned int irq) { }

#endif
#endif


static DEFINE_SPINLOCK(irq_2_ir_lock);
static DEFINE_SPINLOCK(irq_2_ir_lock);
@@ -440,6 +452,8 @@ int free_irte(int irq)


	spin_unlock_irqrestore(&irq_2_ir_lock, flags);
	spin_unlock_irqrestore(&irq_2_ir_lock, flags);


	irq_2_iommu_free(irq);

	return rc;
	return rc;
}
}