[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] linux: restrict IRQ probing



Since IRQ probing may touch all currently unused interrupts, we must
prevent probing for those where it doesn't make sense (to avoid
triggering BUG()s or de-referencing NULL function pointers):
- dynamic IRQs must never be probed
- physical IRQs should only be probed when registered or identity-mapped

I haven't got feedback from the reporting party, yet, but as the change
seems correct in any case, I thought I'd submit it right away.

As usual, written and tested on 2.6.27-rc8 and made apply to the 2.6.18
tree without further testing.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

Index: head-2008-10-01/drivers/xen/core/evtchn.c
===================================================================
--- head-2008-10-01.orig/drivers/xen/core/evtchn.c      2008-09-17 
14:06:19.000000000 +0200
+++ head-2008-10-01/drivers/xen/core/evtchn.c   2008-10-02 16:52:17.000000000 
+0200
@@ -784,7 +784,16 @@ static struct irq_chip dynirq_chip = {
 
 void evtchn_register_pirq(int irq)
 {
+       struct irq_desc *desc;
+       unsigned long flags;
+
        irq_info[irq] = mk_irq_info(IRQT_PIRQ, irq, 0);
+
+       /* Cannot call set_irq_probe(), as that's marked __init. */
+       desc = irq_desc + irq;
+       spin_lock_irqsave(&desc->lock, flags);
+       desc->status &= ~IRQ_NOPROBE;
+       spin_unlock_irqrestore(&desc->lock, flags);
 }
 
 #if defined(CONFIG_X86_IO_APIC)
@@ -1177,7 +1186,7 @@ void __init xen_init_IRQ(void)
        for (i = DYNIRQ_BASE; i < (DYNIRQ_BASE + NR_DYNIRQS); i++) {
                irq_bindcount[i] = 0;
 
-               irq_desc[i].status = IRQ_DISABLED;
+               irq_desc[i].status = IRQ_DISABLED|IRQ_NOPROBE;
                irq_desc[i].action = NULL;
                irq_desc[i].depth = 1;
                irq_desc[i].chip = &dynirq_type;
@@ -1196,6 +1105,8 @@ void __init xen_init_IRQ(void)
 #endif
 
                irq_desc[i].status = IRQ_DISABLED;
+               if (!identity_mapped_irq(i))
+                       irq_desc[i].status |= IRQ_NOPROBE;
                irq_desc[i].action = NULL;
                irq_desc[i].depth = 1;
                irq_desc[i].chip = &pirq_type;




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.