All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Vladimir 'phcoder' Serbinenko" <phcoder@gmail.com>
To: Eric Snowberg <eric.snowberg@oracle.com>
Cc: daniel.kiper@oracle.com, grub-devel@gnu.org
Subject: Re: [PATCH] ls: prevent double open
Date: Wed, 18 Oct 2017 16:32:19 +0000	[thread overview]
Message-ID: <CAEaD8JMmtoVXdVhooWv6DFkZxxeODyjE=-D1yRmscqgq=hakmw@mail.gmail.com> (raw)
In-Reply-To: <1508184672-164532-1-git-send-email-eric.snowberg@oracle.com>

[-- Attachment #1: Type: text/plain, Size: 1298 bytes --]

On Mon, Oct 16, 2017, 22:11 Eric Snowberg <eric.snowberg@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.snowberg@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
>
>

[-- Attachment #2: Type: text/html, Size: 1897 bytes --]

  parent reply	other threads:[~2017-10-18 16:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-16 20:11 [PATCH] ls: prevent double open Eric Snowberg
2017-10-17 13:22 ` Daniel Kiper
2017-10-18 16:30   ` Eric Snowberg
2017-11-10 21:35     ` Daniel Kiper
2017-11-13 16:11       ` John Paul Adrian Glaubitz
2017-10-18 16:32 ` Vladimir 'phcoder' Serbinenko [this message]
2017-10-18 17:02   ` Eric Snowberg
2017-10-18 17:03     ` Vladimir 'phcoder' Serbinenko
2017-10-18 21:01       ` Eric Snowberg
2017-11-07 21:17         ` John Paul Adrian Glaubitz
2017-11-07 21:26           ` Daniel Kiper

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='CAEaD8JMmtoVXdVhooWv6DFkZxxeODyjE=-D1yRmscqgq=hakmw@mail.gmail.com' \
    --to=phcoder@gmail.com \
    --cc=daniel.kiper@oracle.com \
    --cc=eric.snowberg@oracle.com \
    --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.