References: bnc#735806 # HG changeset patch # User Jan Beulich # Date 1325492779 -3600 # Node ID 3a22ed3ec534799b3cab55b0dc0a7380e701ecbe # Parent a7b2610b8e5c9a15b1f5de9a3eabf7f19d0b4199 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 --- a/xen/arch/x86/physdev.c +++ b/xen/arch/x86/physdev.c @@ -228,7 +228,8 @@ static int physdev_unmap_pirq(struct phy if ( is_hvm_domain(d) ) { spin_lock(&d->event_lock); - ret = unmap_domain_pirq_emuirq(d, unmap->pirq); + if ( domain_pirq_to_emuirq(d, unmap->pirq) != IRQ_UNBOUND ) + ret = unmap_domain_pirq_emuirq(d, unmap->pirq); spin_unlock(&d->event_lock); if ( unmap->domid == DOMID_SELF || ret ) goto free_domain;