]> git.baikalelectronics.ru Git - kernel.git/commit
intel-iommu: Fix double lock in get_domain_for_dev()
authorJiri Slaby <jirislaby@gmail.com>
Mon, 14 Jun 2010 15:17:32 +0000 (17:17 +0200)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Tue, 15 Jun 2010 09:50:46 +0000 (10:50 +0100)
commit7fa5bc167721ec139cff6d94ac2b8bfa6a9c0cee
tree16f6096b5ab13a42c7119e3d5f9c0b21817eacaf
parent7cff4fcff3596256b74c938cc7c943e20eb10626
intel-iommu: Fix double lock in get_domain_for_dev()

stanse found the following double lock.

In get_domain_for_dev:
  spin_lock_irqsave(&device_domain_lock, flags);
  domain_exit(domain);
    domain_remove_dev_info(domain);
      spin_lock_irqsave(&device_domain_lock, flags);
      spin_unlock_irqrestore(&device_domain_lock, flags);
  spin_unlock_irqrestore(&device_domain_lock, flags);

This happens when the domain is created by another CPU at the same time
as this function is creating one, and the other CPU wins the race to
attach it to the device in question, so we have to destroy our own
newly-created one.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/pci/intel-iommu.c