From: Heiko Carstens Date: Mon, 7 Sep 2020 15:11:36 +0000 (+0200) Subject: s390/mm,ptdump: hold memory hotplug lock while walking for kernel page table dump X-Git-Tag: v5.15~2652^2~71 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=36c2733c439caa424fe2b7dded870913dcb868ac;p=platform%2Fkernel%2Flinux-starfive.git s390/mm,ptdump: hold memory hotplug lock while walking for kernel page table dump This is the s390 variant of commit bf2b59f60ee1 ("arm64/mm: Hold memory hotplug lock while walking for kernel page table dump"). Right now this doesn't fix any real bug, however as soon as kvm patches get merged which make use of memory remove we might end up dereferencing/accessing freed page tables. Therefore fix this potential bug already now. Reviewed-by: Vasily Gorbik Signed-off-by: Heiko Carstens Signed-off-by: Vasily Gorbik --- diff --git a/arch/s390/mm/dump_pagetables.c b/arch/s390/mm/dump_pagetables.c index 93a29e2..3c5e405 100644 --- a/arch/s390/mm/dump_pagetables.c +++ b/arch/s390/mm/dump_pagetables.c @@ -129,7 +129,9 @@ static int ptdump_show(struct seq_file *m, void *v) .marker = address_markers, }; + get_online_mems(); ptdump_walk_pgd(&st.ptdump, &init_mm, NULL); + put_online_mems(); return 0; } DEFINE_SHOW_ATTRIBUTE(ptdump);