diff options
Diffstat (limited to 'drivers/pci/proc.c')
-rw-r--r-- | drivers/pci/proc.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c index e1098c302c45..7fb086d39617 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) | |||
252 | const struct proc_dir_entry *dp = PDE(inode); | 252 | const struct proc_dir_entry *dp = PDE(inode); |
253 | struct pci_dev *dev = dp->data; | 253 | struct pci_dev *dev = dp->data; |
254 | struct pci_filp_private *fpriv = file->private_data; | 254 | struct pci_filp_private *fpriv = file->private_data; |
255 | int ret; | 255 | int i, ret; |
256 | 256 | ||
257 | if (!capable(CAP_SYS_RAWIO)) | 257 | if (!capable(CAP_SYS_RAWIO)) |
258 | return -EPERM; | 258 | return -EPERM; |
259 | 259 | ||
260 | /* Make sure the caller is mapping a real resource for this device */ | ||
261 | for (i = 0; i < PCI_ROM_RESOURCE; i++) { | ||
262 | if (pci_mmap_fits(dev, i, vma)) | ||
263 | break; | ||
264 | } | ||
265 | |||
266 | if (i >= PCI_ROM_RESOURCE) | ||
267 | return -ENODEV; | ||
268 | |||
260 | ret = pci_mmap_page_range(dev, vma, | 269 | ret = pci_mmap_page_range(dev, vma, |
261 | fpriv->mmap_state, | 270 | fpriv->mmap_state, |
262 | fpriv->write_combine); | 271 | fpriv->write_combine); |