]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
kho: kho_restore_vmalloc: fix initialization of pages array
authorMike Rapoport (Microsoft) <rppt@kernel.org>
Tue, 25 Nov 2025 11:09:16 +0000 (13:09 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 27 Nov 2025 22:24:44 +0000 (14:24 -0800)
Patch series "kho: fixes for vmalloc restoration".

Pratyush reported off-list that when kho_restore_vmalloc() is used to
restore a vmalloc_huge() allocation it hits VM_BUG_ON() when we
reconstruct the struct pages in kho_restore_pages().

These patches fix the issue.

This patch (of 2):

In case a preserved vmalloc allocation was using huge pages, all pages in
the array of pages added to vm_struct during kho_restore_vmalloc() are
wrongly set to the same page.

Fix the indexing when assigning pages to that array.

Link: https://lkml.kernel.org/r/20251125110917.843744-1-rppt@kernel.org
Link: https://lkml.kernel.org/r/20251125110917.843744-2-rppt@kernel.org
Fixes: a667300bd53f ("kho: add support for preserving vmalloc allocations")
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
Cc: Alexander Graf <graf@amazon.com>
Cc: Pasha Tatashin <pasha.tatashin@soleen.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kernel/liveupdate/kexec_handover.c

index f9b5306066938c88c5749f9576f795373359696f..096b7db28baf784ac3af6ff32d01fb4b198eabb4 100644 (file)
@@ -1096,7 +1096,7 @@ void *kho_restore_vmalloc(const struct kho_vmalloc *preservation)
                                goto err_free_pages_array;
 
                        for (int j = 0; j < contig_pages; j++)
-                               pages[idx++] = page;
+                               pages[idx++] = page + j;
 
                        phys += contig_pages * PAGE_SIZE;
                }