On Mon, Oct 16, 2017, 22:11 Eric Snowberg <eric.snowb...@oracle.com> wrote:

> Prevent a double open.  This can cause problems with some ieee1275
> devices, causing the system to hang.  The double open can occur
> as follows:
>
Why does it? Underlying firmware device should not be aware of how many
times grub device is open. If it is and it causes bugs, then it's a bug in
device driver

>
> grub_ls_list_files (char *dirname, int longlist, int all, int human)
>        dev = grub_device_open (device_name);
>        dev remains open while:
>        grub_normal_print_device_info (device_name);
>                 dev = grub_device_open (name);
>
> Signed-off-by: Eric Snowberg <eric.snowb...@oracle.com>
> ---
>  grub-core/commands/ls.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/grub-core/commands/ls.c b/grub-core/commands/ls.c
> index 0eaf836..a7318ab 100644
> --- a/grub-core/commands/ls.c
> +++ b/grub-core/commands/ls.c
> @@ -201,6 +201,8 @@ grub_ls_list_files (char *dirname, int longlist, int
> all, int human)
>        if (grub_errno == GRUB_ERR_UNKNOWN_FS)
>         grub_errno = GRUB_ERR_NONE;
>
> +      grub_device_close (dev);
> +      dev = NULL;
>        grub_normal_print_device_info (device_name);
>      }
>    else if (fs)
> --
> 1.7.1
>
>
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to