Hi,

* kern/dl.c (grub_dl_load_core): Call grub_dl_call_init only after
successful grub_dl_add

With this patch the module's init function will no longer be called:
- if the module is already loaded
- if malloc fails in grub_dl_add
- before the module is added to grub_dl_head

The first two are errors and cause the load to abort. The module shouldn't try to init if it's only going to abort. I don't know much about grub_dl_head, so I don't know if #3 could have caused problems.

-joe

-=-=-=-=-=-=-=-=-=-=-=-=-
--- a/grub2/kern/dl.c   2009-07-07 16:58:01.000000000 -0700
+++ b/grub2/kern/dl.c   2009-07-16 13:57:18.000000000 -0700
@@ -558,16 +558,17 @@
  grub_dl_flush_cache (mod);

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

+  grub_dl_call_init (mod);
+
  return mod;
}

/* Load a module from the file FILENAME.  */



_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to