ChangeLog:
* kern/dl.c (grub_dl_load_core): Call grub_dl_call_init() only
after grub_dl_add() succeeds. Set mod->ref_count to 1 later to
allow grub_dl_unload() to work.
Original patch by Joe Auricchio <[email protected]>
---
kern/dl.c | 14 +++++---------
1 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/kern/dl.c b/kern/dl.c
index 78ebc1e..ebde547 100644
--- a/kern/dl.c
+++ b/kern/dl.c
@@ -539,14 +539,13 @@ grub_dl_load_core (void *addr, grub_size_t size)
if (! mod)
return 0;
- mod->ref_count = 1;
-
grub_dprintf ("modules", "relocating to %p\n", mod);
if (grub_dl_resolve_name (mod, e)
|| grub_dl_resolve_dependencies (mod, e)
|| grub_dl_load_segments (mod, e)
|| grub_dl_resolve_symbols (mod, e)
- || grub_arch_dl_relocate_symbols (mod, e))
+ || grub_arch_dl_relocate_symbols (mod, e)
+ || grub_dl_add (mod))
{
mod->fini = 0;
grub_dl_unload (mod);
@@ -557,13 +556,10 @@ grub_dl_load_core (void *addr, grub_size_t size)
grub_dprintf ("modules", "module name: %s\n", mod->name);
grub_dprintf ("modules", "init function: %p\n", mod->init);
- grub_dl_call_init (mod);
- if (grub_dl_add (mod))
- {
- grub_dl_unload (mod);
- return 0;
- }
+ mod->ref_count = 1;
+
+ grub_dl_call_init (mod);
return mod;
}
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel