grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/3] Don't initialize module before grub_dl_add() succeeds


From: Vladimir 'phcoder' Serbinenko
Subject: Re: [PATCH 1/3] Don't initialize module before grub_dl_add() succeeds
Date: Thu, 23 Jul 2009 10:33:00 +0200

On Wed, Jul 22, 2009 at 2:47 AM, Pavel Roskin<address@hidden> wrote:
> 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>
Ok with me
> ---
>  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
> address@hidden
> http://lists.gnu.org/mailman/listinfo/grub-devel
>



-- 
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git




reply via email to

[Prev in Thread] Current Thread [Next in Thread]