]> git.baikalelectronics.ru Git - kernel.git/commit
Revert "PCI: Use to_pci_driver() instead of pci_dev->driver"
authorBjorn Helgaas <bhelgaas@google.com>
Wed, 10 Nov 2021 18:03:34 +0000 (12:03 -0600)
committerBjorn Helgaas <bhelgaas@google.com>
Thu, 11 Nov 2021 19:36:22 +0000 (13:36 -0600)
commitec6cf8802d745c9db8387440ffa4616772e44014
treed7899667bdfeea595319549c90a184ecf5849490
parentef1c62c89a13c6967fb827498f2154b5933bfb72
Revert "PCI: Use to_pci_driver() instead of pci_dev->driver"

This reverts commit ae52a83bda6c74bab78c08edfd2f5d4a9317c413.

Robert reported a NULL pointer dereference caused by the PCI core
(local_pci_probe()) calling the i2c_designware_pci driver's
.runtime_resume() method before the .probe() method.  i2c_dw_pci_resume()
depends on initialization done by i2c_dw_pci_probe().

Prior to ae52a83bda6c ("PCI: Use to_pci_driver() instead of
pci_dev->driver"), pci_pm_runtime_resume() avoided calling the
.runtime_resume() method because pci_dev->driver had not been set yet.

ae52a83bda6c and 73d8b4c6fc7c ("PCI: Remove struct pci_dev->driver"),
removed pci_dev->driver, replacing it by device->driver, which *has* been
set by this time, so pci_pm_runtime_resume() called the .runtime_resume()
method when it previously had not.

Fixes: ae52a83bda6c ("PCI: Use to_pci_driver() instead of pci_dev->driver")
Link: https://lore.kernel.org/linux-i2c/CAP145pgdrdiMAT7=-iB1DMgA7t_bMqTcJL4N0=6u8kNY3EU0dw@mail.gmail.com/
Reported-by: Robert Święcki <robert@swiecki.net>
Tested-by: Robert Święcki <robert@swiecki.net>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/iov.c
drivers/pci/pci-driver.c
drivers/pci/pci.c
drivers/pci/pcie/err.c