aboutsummaryrefslogtreecommitdiff
path: root/core/drivers/gic.c
diff options
context:
space:
mode:
authorMathieu Briand <mbriand@witekio.com>2017-03-03 14:49:23 +0100
committerJerome Forissier <jerome.forissier@linaro.org>2017-04-21 13:59:17 +0200
commit3b3a4611ebbe6a749d76152b35236aaa5b99977e (patch)
tree6299bca9afb604a5336d5648e6e8ff854842e08b /core/drivers/gic.c
parent38f2377287f3f6dafde5200d4ad3f4762c530e1c (diff)
core: arm: Do not handle unsupported interrupts
Trying to handle an interrupt with an ID above the maximum will result in a kernel panic as the itr_handle() function will try to disable this unhandled interruption. Interrupts with a high ID will now be simply ignored. Signed-off-by: Mathieu Briand <mbriand@witekio.com> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Diffstat (limited to 'core/drivers/gic.c')
-rw-r--r--core/drivers/gic.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/core/drivers/gic.c b/core/drivers/gic.c
index 93979a0a..459129cf 100644
--- a/core/drivers/gic.c
+++ b/core/drivers/gic.c
@@ -81,8 +81,6 @@
/* Maximum number of interrups a GIC can support */
#define GIC_MAX_INTS 1020
-#define GIC_SPURIOUS_ID 1023
-
#define GICC_IAR_IT_ID_MASK 0x3ff
#define GICC_IAR_CPU_ID_MASK 0x7
#define GICC_IAR_CPU_ID_SHIFT 10
@@ -380,10 +378,10 @@ void gic_it_handle(struct gic_data *gd)
iar = gic_read_iar(gd);
id = iar & GICC_IAR_IT_ID_MASK;
- if (id == GIC_SPURIOUS_ID)
- DMSG("ignoring spurious interrupt");
- else
+ if (id < gd->max_it)
itr_handle(id);
+ else
+ DMSG("ignoring interrupt %" PRIu32, id);
gic_write_eoir(gd, iar);
}