From: Pavel Roskin <proski@gnu.org>
To: grub-devel@gnu.org
Subject: [PATCH 1/3] Don't initialize module before grub_dl_add() succeeds
Date: Tue, 21 Jul 2009 20:47:43 -0400 [thread overview]
Message-ID: <20090722004743.22269.56117.stgit@mj.roinet.com> (raw)
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 <jauricchio@gmail.com>
---
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;
}
next reply other threads:[~2009-07-22 0:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-22 0:47 Pavel Roskin [this message]
2009-07-22 0:47 ` [PATCH 2/3] Eliminate grub_dl_call_init() Pavel Roskin
2009-07-23 8:30 ` Vladimir 'phcoder' Serbinenko
2009-07-22 0:47 ` [PATCH 3/3] Merge struct grub_dl_list into struct grub_dl Pavel Roskin
2009-07-23 8:33 ` [PATCH 1/3] Don't initialize module before grub_dl_add() succeeds Vladimir 'phcoder' Serbinenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090722004743.22269.56117.stgit@mj.roinet.com \
--to=proski@gnu.org \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.