arm64/xen: Delete correctly all modules loaded by xen_module
PATCH 1/1 arm64/xen: Delete correctly all modules loaded by xen_module
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 deleted only the first module on the list not freeing all the others.
--- grub-core/loader/arm64/xen_boot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
grub-core/loader/arm64/xen_boot.c +2 -2
@@ -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); }
Signature · 7 lines
2.43.0 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
Quoted 7 lines · Frediano Ziglio via Grub-devel
We need to use
FOR_LIST_ELEMENTS_SAFEinstead ofFOR_LIST_ELEMENTSassingle_binary_unload, called during the loop, is changing the list usinggrub_list_remove.
Given the environment probably the old code simply deleted only the first module on the list not freeing all the others.Signed-off-by Frediano Ziglio <[email protected]>
Daniel
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Quoted 12 lines · Frediano Ziglio via Grub-devel
We need to use
FOR_LIST_ELEMENTS_SAFEinstead ofFOR_LIST_ELEMENTSassingle_binary_unload, called during the loop, is changing the list usinggrub_list_remove.
Given the environment probably the old code simply deleted only the first module on the list not freeing all the others.Signed-off-by Frediano Ziglio <[email protected]>---
Quoted 27 lines
grub-core/loader/arm64/xen_boot.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)grub-core/loader/arm64/xen_boot.c +0
-0@@ -290,9 +290,9 @@ single_binary_unload (struct xen_boot_binary *binary)static void
all_binaries_unload(void)
{grub-core/loader/arm64/xen_boot.c +2
-2-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); }Signature · 7 lines
2.43.0 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel