linux/arch/s390/mm
Gerald Schaefer 8c42dd78df s390/extmem: return correct segment type in __segment_load()
Commit f05f62d042 ("s390/vmem: get rid of memory segment list")
reshuffled the call to vmem_add_mapping() in __segment_load(), which now
overwrites rc after it was set to contain the segment type code.

As result, __segment_load() will now always return 0 on success, which
corresponds to the segment type code SEG_TYPE_SW, i.e. a writeable
segment. This results in a kernel crash when loading a read-only segment
as dcssblk block device, and trying to write to it.

Instead of reshuffling code again, make sure to return the segment type
on success, and also describe this rather delicate and unexpected logic
in the function comment. Also initialize new segtype variable with
invalid value, to prevent possible future confusion.

Fixes: f05f62d042 ("s390/vmem: get rid of memory segment list")
Cc: <stable@vger.kernel.org> # 5.9+
Signed-off-by: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
2023-03-01 20:01:34 +01:00
..
cmm.c s390/cmm: add missing virt_to_phys() conversion 2021-12-10 16:14:25 +01:00
dump_pagetables.c s390/mm,ptdump: avoid Kasan vs Memcpy Real markers swapping 2023-01-31 18:56:36 +01:00
extable.c s390/extable: add EX_TABLE_UA_LOAD_REGPAIR() macro 2022-11-21 13:36:15 +01:00
extmem.c s390/extmem: return correct segment type in __segment_load() 2023-03-01 20:01:34 +01:00
fault.c s390/kfence: fix page fault reporting 2023-02-15 11:07:01 +01:00
gmap.c ARM64: 2022-12-15 11:12:21 -08:00
hugetlbpage.c s390/hugetlb: switch to generic version of follow_huge_pud() 2022-09-11 20:26:01 -07:00
init.c s390/mm: start kernel with DAT enabled 2023-01-13 14:15:05 +01:00
kasan_init.c s390/mem_detect: do not truncate online memory ranges info 2023-02-14 11:45:40 +01:00
maccess.c s390/mm: allocate Absolute Lowcore Area in decompressor 2023-01-13 14:15:06 +01:00
Makefile s390/extable: move extable related functions to mm/extable.c 2022-03-08 00:33:00 +01:00
mmap.c treewide: use get_random_u32() when possible 2022-10-11 17:42:58 -06:00
page-states.c s390/mm: remove unused get_page_state() function 2022-11-23 16:24:07 +01:00
pageattr.c s390/mm,pageattr: don't use pte_val()/pXd_val() as lvalue 2022-03-01 21:05:10 +01:00
pgalloc.c s390/mm: use CRST_ALLOC_ORDER instead of number 2022-02-09 22:56:04 +01:00
pgtable.c s390/mm: add support for RDP (Reset DAT-Protection) 2023-02-14 11:45:39 +01:00
vmem.c s390/vmem: remove unnecessary KASAN checks 2023-02-06 11:13:53 +01:00