From: Ben Hutchings Date: Tue, 1 Jul 2008 16:18:17 +0000 (+0100) Subject: PCI: Restrict VPD read permission to root X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=a94c248113b86bbbc47d027a4004b70f2be298b1;p=linux-beck.git 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 Signed-off-by: Jesse Barnes --- diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 6f3c7446c329..1f855f028e92 100644 --- a/drivers/pci/pci-sysfs.c +++ b/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; attr->size = pdev->vpd->ops->get_size(pdev); attr->attr.name = "vpd"; - attr->attr.mode = S_IRUGO | S_IWUSR; + attr->attr.mode = S_IRUSR | S_IWUSR; attr->read = pci_read_vpd; attr->write = pci_write_vpd; retval = sysfs_create_bin_file(&pdev->dev.kobj, attr);