From: Frediano Ziglio Date: Fri, 4 Jul 2025 08:39:08 +0000 (+0100) Subject: loader/arm64/xen_boot: Remove correctly all modules loaded by xen_module command X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d1a470b694cb73dd053af02081198ef4e5688852;p=thirdparty%2Fgrub.git 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 --- 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); }