From 6c093a91e43873df7f16192fa0e5e4d73592fa64 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Sat, 30 Sep 2017 17:26:03 +0200 Subject: linux: Fix interrupt glue. Previously, we used an invalid pointer to mark interrupts as reserved by Mach. This, however, crashes code trying to iterate over the list of interrupt handlers. Use a valid structure instead. * linux/dev/arch/i386/kernel/irq.c (reserved_mach_handler): New function. (reserved_mach): New variable. (reserve_mach_irqs): Use the new variable. --- linux/dev/arch/i386/kernel/irq.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/linux/dev/arch/i386/kernel/irq.c b/linux/dev/arch/i386/kernel/irq.c index 7753814b..a02e9582 100644 --- a/linux/dev/arch/i386/kernel/irq.c +++ b/linux/dev/arch/i386/kernel/irq.c @@ -393,6 +393,18 @@ probe_irq_off (unsigned long irqs) * Reserve IRQs used by Mach drivers. * Must be called before Linux IRQ detection, after Mach IRQ detection. */ + +static void reserved_mach_handler (int line, void *cookie, struct pt_regs *regs) +{ + /* These interrupts are actually handled in Mach. */ + assert (! "reached"); +} + +static const struct linux_action reserved_mach = + { + reserved_mach_handler, NULL, NULL, 0 + }; + static void reserve_mach_irqs (void) { @@ -401,8 +413,10 @@ reserve_mach_irqs (void) for (i = 0; i < 16; i++) { if (ivect[i] != prtnull && ivect[i] != intnull) - /* Set non-NULL value. */ - irq_action[i] = (struct linux_action *) -1; + /* This dummy action does not specify SA_SHIRQ, so + setup_x86_irq will not try to add a handler to this + slot. Therefore, the cast is safe. */ + irq_action[i] = (struct linux_action *) &reserved_mach; } } -- cgit v1.2.3