1
0
Fork 0
remarkable-linux/arch/mips
Paul Burton de019e7857 MIPS: Fix off-by-one in pci_resource_to_user()
commit 38c0a74fe0 upstream.

The MIPS implementation of pci_resource_to_user() introduced in v3.12 by
commit 4c2924b725 ("MIPS: PCI: Use pci_resource_to_user to map pci
memory space properly") incorrectly sets *end to the address of the
byte after the resource, rather than the last byte of the resource.

This results in userland seeing resources as a byte larger than they
actually are, for example a 32 byte BAR will be reported by a tool such
as lspci as being 33 bytes in size:

    Region 2: I/O ports at 1000 [disabled] [size=33]

Correct this by subtracting one from the calculated end address,
reporting the correct address to userland.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Reported-by: Rui Wang <rui.wang@windriver.com>
Fixes: 4c2924b725 ("MIPS: PCI: Use pci_resource_to_user to map pci memory space properly")
Cc: James Hogan <jhogan@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: linux-mips@linux-mips.org
Cc: stable@vger.kernel.org # v3.12+
Patchwork: https://patchwork.linux-mips.org/patch/19829/
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-28 07:55:41 +02:00
..
alchemy License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ar7 MIPS: AR7: ensure the port type's FCR value is used 2018-01-23 19:58:21 +01:00
ath25 MIPS: ath25: Check for kzalloc allocation failure 2018-03-15 10:54:31 +01:00
ath79 MIPS: ath79: fix register address in ath79_ddr_wb_flush() 2018-07-28 07:55:40 +02:00
bcm47xx MIPS: BCM47XX: Enable 74K Core ExternalSync for PCIe erratum 2018-07-03 11:24:55 +02:00
bcm63xx License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bmips License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
boot MIPS: dts: Boston: Fix PCI bus dtc warnings: 2018-06-21 04:02:41 +09:00
cavium-octeon MIPS: Octeon: Fix logging messages with spurious periods after newlines 2018-05-30 07:52:39 +02:00
cobalt MIPS: Cobalt: Fix typo 2016-08-03 08:16:30 +02:00
configs Merge branch '4.14-features' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2017-09-15 20:43:33 -07:00
dec License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
emma MIPS: Avoid old-style declaration 2017-01-25 02:51:11 +01:00
fw License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
generic MIPS: Generic: Support GIC in EIC mode 2018-04-26 11:02:17 +02:00
include MIPS: io: Add barrier after register read in inX() 2018-07-03 11:24:56 +02:00
jazz License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
jz4740 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
kernel MIPS: Use async IPIs for arch_trigger_cpumask_backtrace() 2018-07-17 11:39:23 +02:00
kvm KVM: Fix spelling mistake: "cop_unsuable" -> "cop_unusable" 2018-05-30 07:51:47 +02:00
lantiq MIPS: lantiq: ase: Enable MFD_SYSCON 2018-03-28 18:24:28 +02:00
lasat License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
lib MIPS: memset.S: Fix clobber of v1 in last_fixup 2018-04-24 09:36:37 +02:00
loongson32 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
loongson64 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
math-emu MIPS: math-emu: Fix final emulation phase for certain instructions 2017-11-30 08:40:44 +00:00
mm MIPS: Fix ioremap() RAM check 2018-07-17 11:39:23 +02:00
mti-malta Update MIPS email addresses 2017-11-03 09:02:30 -07:00
net MIPS: bpf: Fix a typo in build_one_insn() 2017-11-01 00:09:17 +00:00
netlogic License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
oprofile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
paravirt License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pci MIPS: Fix off-by-one in pci_resource_to_user() 2018-07-28 07:55:41 +02:00
pic32 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pistachio License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pmcs-msp71xx License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pnx833x mtd: nand: Rename nand.h into rawnand.h 2017-08-13 10:11:49 +02:00
power License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ralink MIPS: ralink: Fix booting on MT7621 2018-03-28 18:24:27 +02:00
rb532 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sgi-ip22 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sgi-ip27 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sgi-ip32 MIPS: Add missing include files 2017-03-08 10:38:06 +01:00
sibyte License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sni License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
tools Update MIPS email addresses 2017-11-03 09:02:30 -07:00
txx9 MIPS: TXx9: use IS_BUILTIN() for CONFIG_LEDS_CLASS 2018-04-26 11:02:17 +02:00
vdso License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vr41xx License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
xilfpga License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Kbuild MIPS: Disable Werror when W= is set 2017-04-10 11:56:07 +02:00
Kbuild.platforms MIPS: generic: Convert SEAD-3 to a generic board 2016-10-06 18:04:20 +02:00
Kconfig MIPS: Fix typo BIG_ENDIAN to CPU_BIG_ENDIAN 2018-02-22 15:42:27 +01:00
Kconfig.debug License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Makefile MIPS: Add DWARF unwinding to assembly 2017-09-06 11:01:52 +02:00
Makefile.postlink License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00