From: David Hildenbrand Date: Thu, 4 Jun 2020 23:48:44 +0000 (-0700) Subject: kexec_file: don't place kexec images on IORESOURCE_MEM_DRIVER_MANAGED X-Git-Tag: v5.10.7~2446^2~79 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3fe4f4991a2a818277445bd5b8b289305b7dd15d;p=platform%2Fkernel%2Flinux-rpi.git kexec_file: don't place kexec images on IORESOURCE_MEM_DRIVER_MANAGED Memory flagged with IORESOURCE_MEM_DRIVER_MANAGED is special - it won't be part of the initial memmap of the kexec kernel and not all memory might be accessible. Don't place any kexec images onto it. Signed-off-by: David Hildenbrand Signed-off-by: Andrew Morton Cc: Michal Hocko Cc: Pankaj Gupta Cc: Wei Yang Cc: Baoquan He Cc: Dave Hansen Cc: Eric Biederman Cc: Pavel Tatashin Cc: Dan Williams Link: http://lkml.kernel.org/r/20200508084217.9160-4-david@redhat.com Signed-off-by: Linus Torvalds --- diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index faa74d5..bb05fd5 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -540,6 +540,11 @@ static int locate_mem_hole_callback(struct resource *res, void *arg) unsigned long sz = end - start + 1; /* Returning 0 will take to next memory range */ + + /* Don't use memory that will be detected and handled by a driver. */ + if (res->flags & IORESOURCE_MEM_DRIVER_MANAGED) + return 0; + if (sz < kbuf->memsz) return 0;