diff options
author | Jon Hunter <jonathanh@nvidia.com> | 2016-05-10 11:14:35 -0400 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2016-05-11 05:12:41 -0400 |
commit | 9b5d585d148a19bcadae81fa17ddbe3e22efb9e9 (patch) | |
tree | 9d601b1a9c094bc4bc96934443158d8f454a8463 | |
parent | 7c9b973061b03af62734f613f6abec46c0dd4a88 (diff) |
genirq: Ensure IRQ descriptor is valid when setting-up the IRQ
In the function, setup_irq(), we don't check that the descriptor
returned from irq_to_desc() is valid before we start using it. For
example chip_bus_lock() called from setup_irq(), assumes that the
descriptor pointer is valid and doesn't check before dereferencing it.
In many other functions including setup/free_percpu_irq() we do check
that the descriptor returned is not NULL and therefore add the same test
to setup_irq() to ensure the descriptor returned is valid.
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
-rw-r--r-- | kernel/irq/manage.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index cc1cc641d653..ef0bc02c3a70 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c | |||
@@ -1407,7 +1407,7 @@ int setup_irq(unsigned int irq, struct irqaction *act) | |||
1407 | int retval; | 1407 | int retval; |
1408 | struct irq_desc *desc = irq_to_desc(irq); | 1408 | struct irq_desc *desc = irq_to_desc(irq); |
1409 | 1409 | ||
1410 | if (WARN_ON(irq_settings_is_per_cpu_devid(desc))) | 1410 | if (!desc || WARN_ON(irq_settings_is_per_cpu_devid(desc))) |
1411 | return -EINVAL; | 1411 | return -EINVAL; |
1412 | chip_bus_lock(desc); | 1412 | chip_bus_lock(desc); |
1413 | retval = __setup_irq(irq, desc, act); | 1413 | retval = __setup_irq(irq, desc, act); |