xen/pt: Unlock d->event_lock on error paths
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 27 Jun 2017 17:29:55 +0000 (18:29 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 28 Jun 2017 10:18:40 +0000 (11:18 +0100)
Introduced by c/s fba00494268 "x86/pt: enable binding of GSIs to a PVH Dom0"

Spotted by Coverity.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
xen/drivers/passthrough/io.c

index 2fdbba6eb1ef57859a7934ef65b304007b54b0e8..25e3fb407861c4821532c71bd03215e92f3c2e92 100644 (file)
@@ -490,7 +490,11 @@ int pt_irq_create_bind(
             /* MSI_TRANSLATE is not supported for the hardware domain. */
             if ( pt_irq_bind->irq_type != PT_IRQ_TYPE_PCI ||
                  pirq >= hvm_domain_irq(d)->nr_gsis )
+            {
+                spin_unlock(&d->event_lock);
+
                 return -EINVAL;
+            }
             guest_gsi = pirq;
         }
 
@@ -523,6 +527,8 @@ int pt_irq_create_bind(
 
                     if ( mask < 0 || trigger_mode < 0 )
                     {
+                        spin_unlock(&d->event_lock);
+
                         ASSERT_UNREACHABLE();
                         return -EINVAL;
                     }