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 <frediano.ziglio@cloud.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
This commit is contained in:
Frediano Ziglio 2025-07-04 09:39:08 +01:00 committed by Daniel Kiper
parent cf5e52fa85
commit d1a470b694

View 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);
}