]> www.infradead.org Git - users/jedix/linux-maple.git/commit
PCI: Supply CPU physical address (not bus address) to iomem_is_exclusive()
authorBjorn Helgaas <bhelgaas@google.com>
Fri, 8 Apr 2016 00:15:14 +0000 (17:15 -0700)
committerChuck Anderson <chuck.anderson@oracle.com>
Sun, 28 May 2017 02:43:58 +0000 (19:43 -0700)
commit92bcdee9453b0ec1788f4216fc7bb2e607628b7f
treea1b115b1c21aac46029d32f41f8b90fbfae89403
parent1f82e14b48eba413538386403043588bddfca455
PCI: Supply CPU physical address (not bus address) to iomem_is_exclusive()

iomem_is_exclusive() requires a CPU physical address, but on some arches we
supplied a PCI bus address instead.

On most arches, pci_resource_to_user(res) returns "res->start", which is a
CPU physical address.  But on microblaze, mips, powerpc, and sparc, it
returns the PCI bus address corresponding to "res->start".

The result is that pci_mmap_resource() may fail when it shouldn't (if the
bus address happens to match an existing resource), or it may succeed when
it should fail (if the resource is exclusive but the bus address doesn't
match it).

Call iomem_is_exclusive() with "res->start", which is always a CPU physical
address, not the result of pci_resource_to_user().

Fixes: e8de1481fd71 ("resource: allow MMIO exclusivity for device drivers")
Suggested-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: Arjan van de Ven <arjan@linux.intel.com>
Orabug: 22855133
(cherry picked from commit ca620723d4ff9ea7ed484eab46264c3af871b9ae)
Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
(cherry picked from commit aee594b88bfcb58f51e0070de06d3879b3ea4609)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
drivers/pci/pci-sysfs.c