]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/pci/pci-sysfs.c
PCI/ASPM: Calculate LTR_L1.2_THRESHOLD from device characteristics
[mirror_ubuntu-bionic-kernel.git] / drivers / pci / pci-sysfs.c
index 06c7f0b85cd23dc5385993cd1d50e6a595b301e5..b7b4486c275509268469efd0380433d427a0967c 100644 (file)
@@ -919,6 +919,9 @@ static ssize_t pci_write_config(struct file *filp, struct kobject *kobj,
        loff_t init_off = off;
        u8 *data = (u8 *) buf;
 
+       if (kernel_is_locked_down("Direct PCI access"))
+               return -EPERM;
+
        if (off > dev->cfg_size)
                return 0;
        if (off + count > dev->cfg_size) {
@@ -1213,6 +1216,9 @@ static int pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
        enum pci_mmap_state mmap_type;
        struct resource *res = &pdev->resource[bar];
 
+       if (kernel_is_locked_down("Direct PCI access"))
+               return -EPERM;
+
        if (res->flags & IORESOURCE_MEM && iomem_is_exclusive(res->start))
                return -EINVAL;
 
@@ -1293,6 +1299,9 @@ static ssize_t pci_write_resource_io(struct file *filp, struct kobject *kobj,
                                     struct bin_attribute *attr, char *buf,
                                     loff_t off, size_t count)
 {
+       if (kernel_is_locked_down("Direct PCI access"))
+               return -EPERM;
+
        return pci_resource_io(filp, kobj, attr, buf, off, count, true);
 }