[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] ls: prevent double open
From: |
Daniel Kiper |
Subject: |
Re: [PATCH v2] ls: prevent double open |
Date: |
Thu, 23 Nov 2017 16:19:40 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Tue, Nov 21, 2017 at 03:24:38PM -0700, Eric Snowberg wrote:
> > On Nov 21, 2017, at 6:20 AM, Daniel Kiper <address@hidden> wrote:
> > On Mon, Nov 13, 2017 at 08:27:28AM -0800, Eric Snowberg 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:
> >>
> >> 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 <address@hidden>
> >> ---
> >> changes from v1:
> >> - Added comment
> >> ---
> >> grub-core/commands/ls.c | 4 ++++
> >> 1 files changed, 4 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/grub-core/commands/ls.c b/grub-core/commands/ls.c
> >> index 0eaf836..fcbb3da 100644
> >> --- a/grub-core/commands/ls.c
> >> +++ b/grub-core/commands/ls.c
> >> @@ -201,6 +201,10 @@ grub_ls_list_files (char *dirname, int longlist, int
> >> all, int human)
> >> if (grub_errno == GRUB_ERR_UNKNOWN_FS)
> >> grub_errno = GRUB_ERR_NONE;
> >>
> >> + /* Close device to prevent a double open in
> >> + grub_normal_print_device_info. */
> >> + grub_device_close (dev);
> >> + dev = NULL;
> >
> > Are you OK if I put above between "#ifdef GRUB_MACHINE_IEEE1275" and
> > "#endif”?
>
> I suppose you could add that.
Great!
> Is this patch causing problems on a different platform?
Nope, but I would like to be on safe side. So, I will add it and push.
Daniel