All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] ls: prevent double open
@ 2017-11-13 16:27 Eric Snowberg
  2017-11-21 13:20 ` Daniel Kiper
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Snowberg @ 2017-11-13 16:27 UTC (permalink / raw)
  To: grub-devel; +Cc: daniel.kiper, Eric Snowberg

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 <eric.snowberg@oracle.com>
---
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;
       grub_normal_print_device_info (device_name);
     }
   else if (fs)
-- 
1.7.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] ls: prevent double open
  2017-11-13 16:27 [PATCH v2] ls: prevent double open Eric Snowberg
@ 2017-11-21 13:20 ` Daniel Kiper
  2017-11-21 22:24   ` Eric Snowberg
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Kiper @ 2017-11-21 13:20 UTC (permalink / raw)
  To: Eric Snowberg; +Cc: grub-devel

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 <eric.snowberg@oracle.com>
> ---
> 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"?

Daniel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] ls: prevent double open
  2017-11-21 13:20 ` Daniel Kiper
@ 2017-11-21 22:24   ` Eric Snowberg
  2017-11-23 15:19     ` Daniel Kiper
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Snowberg @ 2017-11-21 22:24 UTC (permalink / raw)
  To: The development of GNU GRUB; +Cc: Daniel Kiper


> On Nov 21, 2017, at 6:20 AM, Daniel Kiper <daniel.kiper@oracle.com> 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 <eric.snowberg@oracle.com>
>> ---
>> 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. Is this patch causing problems on a different platform?




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] ls: prevent double open
  2017-11-21 22:24   ` Eric Snowberg
@ 2017-11-23 15:19     ` Daniel Kiper
  2017-11-23 15:32       ` John Paul Adrian Glaubitz
  2017-11-24 15:24       ` Daniel Kiper
  0 siblings, 2 replies; 6+ messages in thread
From: Daniel Kiper @ 2017-11-23 15:19 UTC (permalink / raw)
  To: Eric Snowberg; +Cc: The development of GNU GRUB

On Tue, Nov 21, 2017 at 03:24:38PM -0700, Eric Snowberg wrote:
> > On Nov 21, 2017, at 6:20 AM, Daniel Kiper <daniel.kiper@oracle.com> 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 <eric.snowberg@oracle.com>
> >> ---
> >> 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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] ls: prevent double open
  2017-11-23 15:19     ` Daniel Kiper
@ 2017-11-23 15:32       ` John Paul Adrian Glaubitz
  2017-11-24 15:24       ` Daniel Kiper
  1 sibling, 0 replies; 6+ messages in thread
From: John Paul Adrian Glaubitz @ 2017-11-23 15:32 UTC (permalink / raw)
  To: The development of GNU GRUB, Daniel Kiper, Eric Snowberg

On 11/23/2017 04:19 PM, Daniel Kiper wrote:
>> 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.

Great \o/. Progress :).

Adrian

-- 
  .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
   `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] ls: prevent double open
  2017-11-23 15:19     ` Daniel Kiper
  2017-11-23 15:32       ` John Paul Adrian Glaubitz
@ 2017-11-24 15:24       ` Daniel Kiper
  1 sibling, 0 replies; 6+ messages in thread
From: Daniel Kiper @ 2017-11-24 15:24 UTC (permalink / raw)
  To: Eric Snowberg; +Cc: The development of GNU GRUB

On Thu, Nov 23, 2017 at 04:19:40PM +0100, Daniel Kiper wrote:
> On Tue, Nov 21, 2017 at 03:24:38PM -0700, Eric Snowberg wrote:
> > > On Nov 21, 2017, at 6:20 AM, Daniel Kiper <daniel.kiper@oracle.com> 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 <eric.snowberg@oracle.com>
> > >> ---
> > >> 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.

Pushed!

Daniel


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-11-24 15:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-13 16:27 [PATCH v2] ls: prevent double open Eric Snowberg
2017-11-21 13:20 ` Daniel Kiper
2017-11-21 22:24   ` Eric Snowberg
2017-11-23 15:19     ` Daniel Kiper
2017-11-23 15:32       ` John Paul Adrian Glaubitz
2017-11-24 15:24       ` Daniel Kiper

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.