]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
loader/arm64/xen_boot: Remove correctly all modules loaded by xen_module command
authorFrediano Ziglio <frediano.ziglio@cloud.com>
Fri, 4 Jul 2025 08:39:08 +0000 (09:39 +0100)
committerDaniel Kiper <daniel.kiper@oracle.com>
Fri, 11 Jul 2025 14:33:08 +0000 (16:33 +0200)
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 <frediano.ziglio@cloud.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
grub-core/loader/arm64/xen_boot.c

index 26e1472c9d24d18b2eb71f963efb45546a7edbf9..731f1913a0cdc13941a097b93145cbb5803a923c 100644 (file)
@@ -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);
   }