Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kernel: Fix s390 absolute memory access for /dev/mem

On s390 the prefix page and absolute zero pages are not correctly
returned when reading /dev/mem. The reason is that the s390 asm/io.h
file includes the asm-generic/io.h file which then defines
xlate_dev_mem_ptr() and therefore overwrites the s390 specific
version that does the correct swap operation for prefix and absolute
zero pages. The problem is a regression that was introduced with git
commit cd248341 (s390/pci: base support).

To fix the problem add "#ifndef xlate_dev_mem_ptr" in asm-generic/io.h
and "#define xlate_dev_mem_ptr" in asm/io.h. This ensures that the
s390 version is used. For completeness also add the "#ifndef"
construct for xlate_dev_kmem_ptr().

Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

authored by

Michael Holzheu and committed by
Martin Schwidefsky
576ebd74 abd9a0c3

+5
+1
arch/s390/include/asm/io.h
··· 36 36 } 37 37 38 38 void *xlate_dev_mem_ptr(unsigned long phys); 39 + #define xlate_dev_mem_ptr xlate_dev_mem_ptr 39 40 void unxlate_dev_mem_ptr(unsigned long phys, void *addr); 40 41 41 42 /*
+4
include/asm-generic/io.h
··· 343 343 #endif /* CONFIG_GENERIC_IOMAP */ 344 344 #endif /* CONFIG_HAS_IOPORT */ 345 345 346 + #ifndef xlate_dev_kmem_ptr 346 347 #define xlate_dev_kmem_ptr(p) p 348 + #endif 349 + #ifndef xlate_dev_mem_ptr 347 350 #define xlate_dev_mem_ptr(p) __va(p) 351 + #endif 348 352 349 353 #ifdef CONFIG_VIRT_TO_BUS 350 354 #ifndef virt_to_bus