From d1a470b694cb73dd053af02081198ef4e5688852 Mon Sep 17 00:00:00 2001 From: Frediano Ziglio Date: Fri, 4 Jul 2025 09:39:08 +0100 Subject: [PATCH] loader/arm64/xen_boot: Remove correctly all modules loaded by xen_module command We need to use FOR_LIST_ELEMENTS_SAFE() instead of FOR_LIST_ELEMENTS() as single_binary_unload(), called during the loop, is changing the list using grub_list_remove(). Given the environment probably the old code simply removed only the first module on the list not freeing all the others. Signed-off-by: Frediano Ziglio Reviewed-by: Daniel Kiper Reviewed-by: Sudhakar Kuppusamy --- grub-core/loader/arm64/xen_boot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/loader/arm64/xen_boot.c b/grub-core/loader/arm64/xen_boot.c index 26e1472c9..731f1913a 100644 --- a/grub-core/loader/arm64/xen_boot.c +++ b/grub-core/loader/arm64/xen_boot.c @@ -290,9 +290,9 @@ single_binary_unload (struct xen_boot_binary *binary) static void all_binaries_unload (void) { - struct xen_boot_binary *binary; + struct xen_boot_binary *binary, *next_binary; - FOR_LIST_ELEMENTS (binary, module_head) + FOR_LIST_ELEMENTS_SAFE (binary, next_binary, module_head) { single_binary_unload (binary); } -- 2.47.3