From: Jan Beulich Date: Mon, 2 Jan 2012 08:26:19 +0000 (+0100) Subject: x86/passthrough: don't leak guest IRQs X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=49f9d2493cfb6fd73c4a1c5d7d89c1b3f090c3e4;p=xen.git x86/passthrough: don't leak guest IRQs As unmap_domain_pirq_emuirq() fails on a never mapped pIRQ, it must not be called for the non-emu-IRQ case (to prevent the entire unmap operation failing). Based on a suggestion from Stefano. Signed-off-by: Jan Beulich Tested-by: Yongjie Ren Acked-by: Stefano Stabellini --- diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c index ca4fb59e97..f280c28c6f 100644 --- a/xen/arch/x86/physdev.c +++ b/xen/arch/x86/physdev.c @@ -219,7 +219,8 @@ int physdev_unmap_pirq(domid_t domid, int pirq) if ( is_hvm_domain(d) ) { spin_lock(&d->event_lock); - ret = unmap_domain_pirq_emuirq(d, pirq); + if ( domain_pirq_to_emuirq(d, pirq) != IRQ_UNBOUND ) + ret = unmap_domain_pirq_emuirq(d, pirq); spin_unlock(&d->event_lock); if ( domid == DOMID_SELF || ret ) goto free_domain;