]> git.baikalelectronics.ru Git - kernel.git/commit
PCI: Avoid possible deadlock on pci_lock and p->pi_lock
authorBjorn Helgaas <bhelgaas@google.com>
Sat, 14 Jan 2017 00:05:12 +0000 (18:05 -0600)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 30 Jan 2017 22:55:33 +0000 (16:55 -0600)
commit98e53863dbf3461ded810a6827cb33d598c9d8b7
tree05668a16f75570f3a408b762ea2462180cb26a30
parentb455a3a20a8ea2ca450eacfd2ddb8590967b58fc
PCI: Avoid possible deadlock on pci_lock and p->pi_lock

pci_lock is an IRQ-safe spinlock that protects all accesses to PCI
configuration space (see PCI_OP_READ() and PCI_OP_WRITE() in pci/access.c).

The pci_cfg_access_unlock() path acquires pci_lock, then p->pi_lock (inside
wake_up_all()).  According to lockdep, there is a possible path involving
snbep_uncore_pci_read_counter() that could acquire them in the reverse
order: acquiring p->pi_lock, then pci_lock, which could result in a
deadlock.  Lockdep details are in the bugzilla below.

Avoid the possible deadlock by dropping pci_lock before waking up any
config access waiters.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=192901
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/access.c