]> www.infradead.org Git - users/dwmw2/linux.git/commit
genirq/irqdomain: Don't try to free an interrupt that has no mapping
authorMarc Zyngier <maz@kernel.org>
Sun, 29 Nov 2020 13:55:51 +0000 (13:55 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Dec 2020 12:46:56 +0000 (13:46 +0100)
commitd1874e36cb3d00ba53f9e7bc3ca58d3058659cee
tree6bf444e9b6396d524826aab81ef48fa956da217f
parentb2a2eea570d19ec0ec93dab18c78beb62d80fe78
genirq/irqdomain: Don't try to free an interrupt that has no mapping

[ Upstream commit 4615fbc3788ddc8e7c6d697714ad35a53729aa2c ]

When an interrupt allocation fails for N interrupts, it is pretty
common for the error handling code to free the same number of interrupts,
no matter how many interrupts have actually been allocated.

This may result in the domain freeing code to be unexpectedly called
for interrupts that have no mapping in that domain. Things end pretty
badly.

Instead, add some checks to irq_domain_free_irqs_hierarchy() to make sure
that thiss does not follow the hierarchy if no mapping exists for a given
interrupt.

Fixes: 6a6544e520abe ("genirq/irqdomain: Remove auto-recursive hierarchy support")
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20201129135551.396777-1-maz@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/irq/irqdomain.c