crash_core: fix and simplify the logic of crash_exclude_mem_range()
authorYuntao Wang <ytcoode@gmail.com>
Tue, 2 Jan 2024 14:49:05 +0000 (22:49 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 5 Jan 2024 18:45:25 +0000 (10:45 -0800)
commit6dff315972640bfe542e2d044933751afd8e6c4a
treefb099685e3fc324142ae21dbe592cca96248f4fe
parent61bb219f9d83c1619e59153b837af25873a00a43
crash_core: fix and simplify the logic of crash_exclude_mem_range()

The purpose of crash_exclude_mem_range() is to remove all memory ranges
that overlap with [mstart-mend].  However, the current logic only removes
the first overlapping memory range.

Commit a2e9a95d2190 ("kexec: Improve & fix crash_exclude_mem_range() to
handle overlapping ranges") attempted to address this issue, but it did
not fix all error cases.

Let's fix and simplify the logic of crash_exclude_mem_range().

Link: https://lkml.kernel.org/r/20240102144905.110047-4-ytcoode@gmail.com
Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
Acked-by: Baoquan He <bhe@redhat.com>
Cc: Borislav Petkov (AMD) <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Hari Bathini <hbathini@linux.ibm.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Sourabh Jain <sourabhjain@linux.ibm.com>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kernel/crash_core.c