On Thu, 2026-11-12 at 17:37 +0100, Christian Brauner wrote: > copy_oldmem_page() maps a page of the old kernel that isn't in the > linear mapping with ioremap_cache() and copies from it without > checking > whether the mapping worked. If it didn't, the copy reads from an > offset > into the NULL page. That oopses unless the copy happens to be a user > copy, whose exception table entries turn the fault into a short copy. > > Return -ENOMEM like the other architectures do. read_from_oldmem() > turns that into -EFAULT like any other short copy. > > Reported-by: Chris Mason <[email protected]> > Fixes: 54c32021eb6f ("[PATCH] powerpc: Add arch-dependent > copy_oldmem_page") > Cc: [email protected] > Reviewed-by: Breno Leitao <[email protected]> > Signed-off-by: Christian Brauner (Amutable) <[email protected]>
Reviewed-by: Alexander Mikhalitsyn <[email protected]> > --- > arch/powerpc/kernel/crash_dump.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/arch/powerpc/kernel/crash_dump.c > b/arch/powerpc/kernel/crash_dump.c > index 103b6605dd68f..1543917bd3e1d 100644 > --- a/arch/powerpc/kernel/crash_dump.c > +++ b/arch/powerpc/kernel/crash_dump.c > @@ -86,6 +86,8 @@ ssize_t copy_oldmem_page(struct iov_iter *iter, > unsigned long pfn, > csize = copy_to_iter(vaddr + offset, csize, iter); > } else { > vaddr = ioremap_cache(paddr, PAGE_SIZE); > + if (!vaddr) > + return -ENOMEM; > csize = copy_to_iter(vaddr + offset, csize, iter); > iounmap(vaddr); > }
