瀏覽代碼

PCI: Restrict VPD read permission to root

Some PCI devices will lock up if we attempt to read from VPD addresses
beyond some device-dependent limit.  Until we can identify these
devices and adjust the file size accordingly, only let root read VPD
through sysfs to prevent a DoS by normal users.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Ben Hutchings 17 年之前
父節點
當前提交
a94c248113
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      drivers/pci/pci-sysfs.c

+ 1 - 1
drivers/pci/pci-sysfs.c

@@ -738,7 +738,7 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev)
 			pdev->vpd->attr = attr;
 			pdev->vpd->attr = attr;
 			attr->size = pdev->vpd->ops->get_size(pdev);
 			attr->size = pdev->vpd->ops->get_size(pdev);
 			attr->attr.name = "vpd";
 			attr->attr.name = "vpd";
-			attr->attr.mode = S_IRUGO | S_IWUSR;
+			attr->attr.mode = S_IRUSR | S_IWUSR;
 			attr->read = pci_read_vpd;
 			attr->read = pci_read_vpd;
 			attr->write = pci_write_vpd;
 			attr->write = pci_write_vpd;
 			retval = sysfs_create_bin_file(&pdev->dev.kobj, attr);
 			retval = sysfs_create_bin_file(&pdev->dev.kobj, attr);