From 8c09a7869b615141a60e798f6699b93084a57fd4 Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Tue, 22 May 2012 16:28:45 +0200 Subject: x86: prevent call to xfree() in dump_irqs() while in an irq context Because of c/s 24707:96987c324a4f, dump_irqs() can now be called in an irq context when a bug condition is encountered. If this is the case, ignore the call to xsm_show_irq_ssid() and the subsequent call to xfree(). This prevents an assertion failure in xfree(), and should allow all the debug information to be dumped, before failing with a BUG() because of the underlying race condition we are attempting to reproduce. Signed-off-by: Andrew Cooper Rather than using the non-obvious conditional around an xfree() that would be passed NULL only in the inverse case (which could easily get removed by a future change on the basis that calling xfree(NULL) is benign), switch the order of checks in xfree() itself and only suppress the call to XSM that could potentially call xmalloc(). Signed-off-by: Jan Beulich Acked-by: Keir Fraser Committed-by: Jan Beulich --- xen/arch/x86/irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xen/arch/x86/irq.c') diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c index 496c8048ae..78a02e3290 100644 --- a/xen/arch/x86/irq.c +++ b/xen/arch/x86/irq.c @@ -2060,7 +2060,7 @@ static void dump_irqs(unsigned char key) if ( !irq_desc_initialized(desc) || desc->handler == &no_irq_type ) continue; - ssid = xsm_show_irq_sid(irq); + ssid = in_irq() ? NULL : xsm_show_irq_sid(irq); spin_lock_irqsave(&desc->lock, flags); -- cgit v1.2.3