Right after the loop the lock is being dropped, so all loop exits should happen with the lock still held. Reported-by: Kristoffer Egefelt <kristoffer@itoc.dk> Signed-off-by: Jan Beulich <jbeulich@suse.com> Tested-by: Kristoffer Egefelt <kristoffer@itoc.dk> --- 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 ) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Andrew Cooper
2013-Oct-11 09:02 UTC
Re: [PATCH] x86/MSI: fix locking in pci_restore_msi_state()
On 11/10/2013 09:46, Jan Beulich wrote:> Right after the loop the lock is being dropped, so all loop exits > should happen with the lock still held. > > Reported-by: Kristoffer Egefelt <kristoffer@itoc.dk> > Signed-off-by: Jan Beulich <jbeulich@suse.com> > Tested-by: Kristoffer Egefelt <kristoffer@itoc.dk>Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>> > --- 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 ) > > > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel