Skip to contentSkip to conversation

x86/MSI: fix locking in pci_restore_msi_state()

PATCH In review Jan Beulich 2 participants 2 messages Oct 11, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

xen/arch/x86/msi.c +1 -1
@@ -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 )

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.

xen/arch/x86/msi.c +1 -1
@@ -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 )

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Jan Beulich

Right after the loop the lock is being dropped, so all loop exits should happen with the lock still held.

Quoted 21 lines
xen/arch/x86/msi.c +1 -1
@@ -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 )
Quoted 4 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel