PCI: Prevent users from disabling devices in use
PATCH 1/1 PCI: Prevent users from disabling devices in use
This patch returns busy status if a user tried to alter the enabled status of a device owned by a driver. There is no good reason to provide a convenient method to a user for altering the fundamental state of a pci device out from under a driver using it.
Signed-off-by Keith Busch <[email protected]>
--- drivers/pci/pci-sysfs.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/pci-sysfs.c +2 -0
@@ -287,6 +287,8 @@ static ssize_t enable_store(struct device *dev, struct device_attribute *attr,/* this can crash the machine when done on the "wrong" device */ if (!capable (CAP_SYS_ADMIN ))return -EPERM ; +if (pdev->driver) +return -EBUSY ;if (!val) {if (pci_is_enabled (pdev))
Signature · 1 line
2.13.6