diff options
author | Brian Norris <briannorris@chromium.org> | 2017-04-20 23:36:25 +0300 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2017-04-28 18:38:00 +0300 |
commit | a5f40e8098fe6d983fdb3beb7b50a8067c136141 (patch) | |
tree | a98617d22761b5b620ac2af829e15f9afe6d00ea /drivers/pci/host | |
parent | ef1b5dad5a386885998d11eb45ca7fd183079965 (diff) | |
download | linux-a5f40e8098fe6d983fdb3beb7b50a8067c136141.tar.xz |
PCI: Don't allow unbinding host controllers that aren't prepared
Many PCI host controller drivers aren't prepared to have their devices
unbound from them forcefully (e.g., through /sys/.../<driver>/unbind), as
they don't provide any driver .remove callback, where they'd detach the
root bus, release resources, etc. Keeping the driver built in (i.e., not a
loadable module) is not enough; and providing no .remove callback just
means we don't do any teardown.
To rule out the possibility of unbinding a device via sysfs, we need to set
the ".suppress_bind_attrs" field.
I found the suspect drivers via the following search:
git grep -l platform_driver $(git grep -L -e '\.remove' -e suppress_bind_attrs drivers/pci/)
Then I inspected them to ensure that
(a) they set up a PCI bus in their probe() and
(b) they don't have a remove() callback for undoing the setup
Suggested-by: Bjorn Helgaas <helgaas@kernel.org>
Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/host')
-rw-r--r-- | drivers/pci/host/pci-ftpci100.c | 1 | ||||
-rw-r--r-- | drivers/pci/host/pci-host-generic.c | 1 | ||||
-rw-r--r-- | drivers/pci/host/pci-thunder-ecam.c | 1 | ||||
-rw-r--r-- | drivers/pci/host/pci-thunder-pem.c | 1 | ||||
-rw-r--r-- | drivers/pci/host/pci-versatile.c | 1 | ||||
-rw-r--r-- | drivers/pci/host/pci-xgene.c | 1 |
6 files changed, 6 insertions, 0 deletions
diff --git a/drivers/pci/host/pci-ftpci100.c b/drivers/pci/host/pci-ftpci100.c index c0f29d1de341..d26501c4145a 100644 --- a/drivers/pci/host/pci-ftpci100.c +++ b/drivers/pci/host/pci-ftpci100.c @@ -556,6 +556,7 @@ static struct platform_driver faraday_pci_driver = { .driver = { .name = "ftpci100", .of_match_table = of_match_ptr(faraday_pci_of_match), + .suppress_bind_attrs = true, }, .probe = faraday_pci_probe, }; diff --git a/drivers/pci/host/pci-host-generic.c b/drivers/pci/host/pci-host-generic.c index c05ea9d72f69..7d709a7e0aa8 100644 --- a/drivers/pci/host/pci-host-generic.c +++ b/drivers/pci/host/pci-host-generic.c @@ -60,6 +60,7 @@ static struct platform_driver gen_pci_driver = { .driver = { .name = "pci-host-generic", .of_match_table = gen_pci_of_match, + .suppress_bind_attrs = true, }, .probe = gen_pci_probe, }; diff --git a/drivers/pci/host/pci-thunder-ecam.c b/drivers/pci/host/pci-thunder-ecam.c index 3f54a43bbbea..fc0ca03f280e 100644 --- a/drivers/pci/host/pci-thunder-ecam.c +++ b/drivers/pci/host/pci-thunder-ecam.c @@ -373,6 +373,7 @@ static struct platform_driver thunder_ecam_driver = { .driver = { .name = KBUILD_MODNAME, .of_match_table = thunder_ecam_of_match, + .suppress_bind_attrs = true, }, .probe = thunder_ecam_probe, }; diff --git a/drivers/pci/host/pci-thunder-pem.c b/drivers/pci/host/pci-thunder-pem.c index 6e031b522529..6e066f8b74df 100644 --- a/drivers/pci/host/pci-thunder-pem.c +++ b/drivers/pci/host/pci-thunder-pem.c @@ -474,6 +474,7 @@ static struct platform_driver thunder_pem_driver = { .driver = { .name = KBUILD_MODNAME, .of_match_table = thunder_pem_of_match, + .suppress_bind_attrs = true, }, .probe = thunder_pem_probe, }; diff --git a/drivers/pci/host/pci-versatile.c b/drivers/pci/host/pci-versatile.c index 85e773661bc8..9281eee2d000 100644 --- a/drivers/pci/host/pci-versatile.c +++ b/drivers/pci/host/pci-versatile.c @@ -222,6 +222,7 @@ static struct platform_driver versatile_pci_driver = { .driver = { .name = "versatile-pci", .of_match_table = versatile_pci_of_match, + .suppress_bind_attrs = true, }, .probe = versatile_pci_probe, }; diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c index de198980432e..8cae013e7188 100644 --- a/drivers/pci/host/pci-xgene.c +++ b/drivers/pci/host/pci-xgene.c @@ -697,6 +697,7 @@ static struct platform_driver xgene_pcie_driver = { .driver = { .name = "xgene-pcie", .of_match_table = of_match_ptr(xgene_pcie_match_table), + .suppress_bind_attrs = true, }, .probe = xgene_pcie_probe_bridge, }; |