]> xenbits.xensource.com Git - people/tklengyel/xen.git/commitdiff
x86/irq: skip unmap_domain_pirq XSM during destruction
authorJason Andryuk <jandryuk@gmail.com>
Fri, 8 Apr 2022 12:51:52 +0000 (14:51 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 8 Apr 2022 12:51:52 +0000 (14:51 +0200)
xsm_unmap_domain_irq was seen denying unmap_domain_pirq when called from
complete_domain_destroy as an RCU callback.  The source context was an
unexpected, random domain.  Since this is a xen-internal operation,
going through the XSM hook is inapproriate.

Check d->is_dying and skip the XSM hook when set since this is a cleanup
operation for a domain being destroyed.

Suggested-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
xen/arch/x86/irq.c

index 285ac399fbfd4c702e93575e3d5a3c9eda9fd2e9..de30ee777915eea9b26cbe5b491f844634e729dc 100644 (file)
@@ -2340,8 +2340,14 @@ int unmap_domain_pirq(struct domain *d, int pirq)
         nr = msi_desc->msi.nvec;
     }
 
-    ret = xsm_unmap_domain_irq(XSM_HOOK, d, irq,
-                               msi_desc ? msi_desc->dev : NULL);
+    /*
+     * When called by complete_domain_destroy via RCU, current is a random
+     * domain.  Skip the XSM check since this is a Xen-initiated action.
+     */
+    if ( !d->is_dying )
+        ret = xsm_unmap_domain_irq(XSM_HOOK, d, irq,
+                                   msi_desc ? msi_desc->dev : NULL);
+
     if ( ret )
         goto done;