From: "Jan Beulich" Subject: [PATCH] linux: restrict IRQ probing Date: Thu, 02 Oct 2008 16:42:23 +0100 Message-ID: <48E507FF.76E4.0078.0@novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org 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 Index: head-2008-10-01/drivers/xen/core/evtchn.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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.0000000= 00 +0200 @@ -784,7 +784,16 @@ static struct irq_chip dynirq_chip =3D { =20 void evtchn_register_pirq(int irq) { + struct irq_desc *desc; + unsigned long flags; + irq_info[irq] =3D mk_irq_info(IRQT_PIRQ, irq, 0); + + /* Cannot call set_irq_probe(), as that's marked __init. */ + desc =3D irq_desc + irq; + spin_lock_irqsave(&desc->lock, flags); + desc->status &=3D ~IRQ_NOPROBE; + spin_unlock_irqrestore(&desc->lock, flags); } =20 #if defined(CONFIG_X86_IO_APIC) @@ -1177,7 +1186,7 @@ void __init xen_init_IRQ(void) for (i =3D DYNIRQ_BASE; i < (DYNIRQ_BASE + NR_DYNIRQS); i++) { irq_bindcount[i] =3D 0; =20 - irq_desc[i].status =3D IRQ_DISABLED; + irq_desc[i].status =3D IRQ_DISABLED|IRQ_NOPROBE; irq_desc[i].action =3D NULL; irq_desc[i].depth =3D 1; irq_desc[i].chip =3D &dynirq_type; @@ -1196,6 +1105,8 @@ void __init xen_init_IRQ(void) #endif =20 irq_desc[i].status =3D IRQ_DISABLED; + if (!identity_mapped_irq(i)) + irq_desc[i].status |=3D IRQ_NOPROBE; irq_desc[i].action =3D NULL; irq_desc[i].depth =3D 1; irq_desc[i].chip =3D &pirq_type;