x86/passthrough: don't leak guest IRQs
authorJan Beulich <jbeulich@suse.com>
Mon, 2 Jan 2012 08:26:19 +0000 (09:26 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 2 Jan 2012 08:26:19 +0000 (09:26 +0100)
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 <jbeulich@suse.com>
Tested-by: Yongjie Ren <yongjie.ren@intel.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
xen/arch/x86/physdev.c

index ca4fb59e97b8ff7cd31966d444cc4ff4eab8cd4c..f280c28c6f2b44b9f674011f93b8af466eb19b71 100644 (file)
@@ -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;