[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/3] Don't initialize module before grub_dl_add() succeeds
From: |
Pavel Roskin |
Subject: |
[PATCH 1/3] Don't initialize module before grub_dl_add() succeeds |
Date: |
Tue, 21 Jul 2009 20:47:43 -0400 |
User-agent: |
StGit/0.15-rc1-9-gd8846 |
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 <address@hidden>
---
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;
}
- [PATCH 1/3] Don't initialize module before grub_dl_add() succeeds,
Pavel Roskin <=