The patch titled pci: fix range check on mmapped sysfs resource files has been added to the -mm tree. Its filename is pci-fix-range-check-on-mmapped-sysfs-resource-files.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: pci: fix range check on mmapped sysfs resource files From: "Ed Swierk" <eswierk@xxxxxxxxxxxxxxxxxx> pci_mmap_fits() returns the wrong answer if the sysfs resource file size is not a multiple of the page size. vm_end and vm_start are already page-aligned, so size - start < nr, causing mmap() to return EINVAL. Signed-off-by: Ed Swierk <eswierk@xxxxxxxxxxxxxxxxxx> Cc: Jesse Barnes <jbarnes@xxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/pci/pci-sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff -puN drivers/pci/pci-sysfs.c~pci-fix-range-check-on-mmapped-sysfs-resource-files drivers/pci/pci-sysfs.c --- a/drivers/pci/pci-sysfs.c~pci-fix-range-check-on-mmapped-sysfs-resource-files +++ a/drivers/pci/pci-sysfs.c @@ -575,7 +575,7 @@ int pci_mmap_fits(struct pci_dev *pdev, nr = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; start = vma->vm_pgoff; - size = pci_resource_len(pdev, resno) >> PAGE_SHIFT; + size = ((pci_resource_len(pdev, resno) - 1) >> PAGE_SHIFT) + 1; if (start < size && size - start >= nr) return 1; WARN(1, "process \"%s\" tried to map 0x%08lx-0x%08lx on %s BAR %d (size 0x%08lx)\n", _ Patches currently in -mm which might be from eswierk@xxxxxxxxxxxxxxxxxx are pci-fix-range-check-on-mmapped-sysfs-resource-files.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html