diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-01-11 03:41:39 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-01-11 03:41:39 +0100 |
commit | abede81c4fb2e3b85d8760f25e3da39d2c69a134 (patch) | |
tree | 26c893ec108d837eb9171d678c55a1cea7b22af4 /drivers/pci/proc.c | |
parent | c9d557c19f94df42db78d4a5de4d25feee694bad (diff) | |
parent | c59765042f53a79a7a65585042ff463b69cb248c (diff) | |
download | kernel_samsung_smdk4412-abede81c4fb2e3b85d8760f25e3da39d2c69a134.zip kernel_samsung_smdk4412-abede81c4fb2e3b85d8760f25e3da39d2c69a134.tar.gz kernel_samsung_smdk4412-abede81c4fb2e3b85d8760f25e3da39d2c69a134.tar.bz2 |
Merge commit 'v2.6.29-rc1' into core/urgent
Diffstat (limited to 'drivers/pci/proc.c')
-rw-r--r-- | drivers/pci/proc.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c index e1098c3..593bb84 100644 --- a/drivers/pci/proc.c +++ b/drivers/pci/proc.c @@ -252,11 +252,20 @@ static int proc_bus_pci_mmap(struct file *file, struct vm_area_struct *vma) const struct proc_dir_entry *dp = PDE(inode); struct pci_dev *dev = dp->data; struct pci_filp_private *fpriv = file->private_data; - int ret; + int i, ret; if (!capable(CAP_SYS_RAWIO)) return -EPERM; + /* Make sure the caller is mapping a real resource for this device */ + for (i = 0; i < PCI_ROM_RESOURCE; i++) { + if (pci_mmap_fits(dev, i, vma)) + break; + } + + if (i >= PCI_ROM_RESOURCE) + return -ENODEV; + ret = pci_mmap_page_range(dev, vma, fpriv->mmap_state, fpriv->write_combine); @@ -352,15 +361,16 @@ static int show_device(struct seq_file *m, void *v) dev->vendor, dev->device, dev->irq); - /* Here should be 7 and not PCI_NUM_RESOURCES as we need to preserve compatibility */ - for (i=0; i<7; i++) { + + /* only print standard and ROM resources to preserve compatibility */ + for (i = 0; i <= PCI_ROM_RESOURCE; i++) { resource_size_t start, end; pci_resource_to_user(dev, i, &dev->resource[i], &start, &end); seq_printf(m, "\t%16llx", (unsigned long long)(start | (dev->resource[i].flags & PCI_REGION_FLAG_MASK))); } - for (i=0; i<7; i++) { + for (i = 0; i <= PCI_ROM_RESOURCE; i++) { resource_size_t start, end; pci_resource_to_user(dev, i, &dev->resource[i], &start, &end); seq_printf(m, "\t%16llx", |