x86/MSI: fix locking in pci_restore_msi_state() Right after the loop the lock is being dropped, so all loop exits should happen with the lock still held. Reported-by: Kristoffer Egefelt Signed-off-by: Jan Beulich Tested-by: Kristoffer Egefelt --- a/xen/arch/x86/msi.c +++ b/xen/arch/x86/msi.c @@ -1158,11 +1158,11 @@ int pci_restore_msi_state(struct pci_dev for ( i = 0; ; ) { msi_set_mask_bit(desc, entry[i].msi_attrib.masked); - spin_unlock_irqrestore(&desc->lock, flags); if ( !--nr ) break; + spin_unlock_irqrestore(&desc->lock, flags); desc = &irq_desc[entry[++i].irq]; spin_lock_irqsave(&desc->lock, flags); if ( desc->msi_desc != entry + i )