All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ieee1275: Fix crash in of_path_of_nvme when of_path is empty
@ 2018-03-01 15:47 John Paul Adrian Glaubitz
  2018-03-01 15:47 ` John Paul Adrian Glaubitz
  2018-03-01 15:49 ` John Paul Adrian Glaubitz
  0 siblings, 2 replies; 8+ messages in thread
From: John Paul Adrian Glaubitz @ 2018-03-01 15:47 UTC (permalink / raw)
  To: grub-devel; +Cc: eric.snowberg, 891773

We have recently backported the upstream changes to Debian's grub2 package
to support modern SPARC hardware for Debian's sparc64 port.

One of the changes introduced a regression on systems with NVME devices
but not 

    The of_path_of_nvme function (commit 2391d57, ieee1275: add nvme
    support within ofpath) introduced a functional regression:
    
    On systems where of_path is empty, i.e. non-OpenFirmware
    machines, grub-probe crashes in of_path_of_nvme when trying
    to append the disk name to an empty of_path.



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

* [PATCH] ieee1275: Fix crash in of_path_of_nvme when of_path is empty
  2018-03-01 15:47 [PATCH] ieee1275: Fix crash in of_path_of_nvme when of_path is empty John Paul Adrian Glaubitz
@ 2018-03-01 15:47 ` John Paul Adrian Glaubitz
  2018-03-01 15:49 ` John Paul Adrian Glaubitz
  1 sibling, 0 replies; 8+ messages in thread
From: John Paul Adrian Glaubitz @ 2018-03-01 15:47 UTC (permalink / raw)
  To: grub-devel; +Cc: eric.snowberg, 891773, John Paul Adrian Glaubitz

The of_path_of_nvme function (commit 2391d57, ieee1275: add nvme
support within ofpath) introduced a functional regression:

On systems where of_path is empty, i.e. non-OpenFirmware
machines, grub-probe crashes in of_path_of_nvme when trying
to append the disk name to an empty of_path.

Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
---
 grub-core/osdep/linux/ofpath.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c
index 1c30e7233..da0000f0f 100644
--- a/grub-core/osdep/linux/ofpath.c
+++ b/grub-core/osdep/linux/ofpath.c
@@ -389,8 +389,13 @@ of_path_of_nvme(const char *sys_devname __attribute__((unused)),
     }
 
   of_path = find_obppath (sysfs_path);
+
+  if(of_path)
+    strcat (of_path, disk);
+  else
+    of_path = strdup(disk);
+
   free (sysfs_path);
-  strcat (of_path, disk);
   return of_path;
 }
 
-- 
2.16.2



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

* Re: [PATCH] ieee1275: Fix crash in of_path_of_nvme when of_path is empty
  2018-03-01 15:47 [PATCH] ieee1275: Fix crash in of_path_of_nvme when of_path is empty John Paul Adrian Glaubitz
  2018-03-01 15:47 ` John Paul Adrian Glaubitz
@ 2018-03-01 15:49 ` John Paul Adrian Glaubitz
  2018-03-01 15:51   ` Bug#891773: Info received ([PATCH] ieee1275: Fix crash in of_path_of_nvme when of_path is empty) Debian Bug Tracking System
  1 sibling, 1 reply; 8+ messages in thread
From: John Paul Adrian Glaubitz @ 2018-03-01 15:49 UTC (permalink / raw)
  To: grub-devel; +Cc: eric.snowberg, 891773

On 03/01/2018 04:47 PM, John Paul Adrian Glaubitz wrote:
> We have recently backported the upstream changes to Debian's grub2 package
> to support modern SPARC hardware for Debian's sparc64 port.
> 
> One of the changes introduced a regression on systems with NVME devices
> but not

Sorry, that message was accidentally sent incompletely. I will re-send the
patch with a proper message. Please don't merge.

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] 8+ messages in thread

* Bug#891773: Info received ([PATCH] ieee1275: Fix crash in of_path_of_nvme when of_path is empty)
  2018-03-01 15:49 ` John Paul Adrian Glaubitz
@ 2018-03-01 15:51   ` Debian Bug Tracking System
  0 siblings, 0 replies; 8+ messages in thread
From: Debian Bug Tracking System @ 2018-03-01 15:51 UTC (permalink / raw)
  To: The development of GNU GRUB

Thank you for the additional information you have supplied regarding
this Bug report.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 GRUB Maintainers <pkg-grub-devel@lists.alioth.debian.org>

If you wish to submit further information on this problem, please
send it to 891773@bugs.debian.org.

Please do not send mail to owner@bugs.debian.org unless you wish
to report a problem with the Bug-tracking system.

-- 
891773: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=891773
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems


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

* Re: [PATCH] ieee1275: Fix crash in of_path_of_nvme when of_path is empty
  2018-03-02  3:10   ` Eric Snowberg
@ 2018-03-05 16:04     ` Daniel Kiper
  0 siblings, 0 replies; 8+ messages in thread
From: Daniel Kiper @ 2018-03-05 16:04 UTC (permalink / raw)
  To: glaubitz; +Cc: 891773, grub-devel, eric.snowberg

On Thu, Mar 01, 2018 at 08:10:10PM -0700, Eric Snowberg wrote:
> > On Mar 1, 2018, at 3:34 PM, John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> wrote:
> >
> > The of_path_of_nvme function (commit 2391d57, ieee1275: add nvme
> > support within ofpath) introduced a functional regression:
> >
> > On systems which are not based on Open Firmware but have at
> > least one NVME device, find_obppath will return NULL and thus
> > trying to append the disk name to of_path will result in a
> > crash.
> >
> > The proper behavior of of_path_of_nvme is, however, to just
> > return NULL in such cases, like other users of find_obppath,
> > such as of_path_of_scsi.
> >
> > Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
> > ---
> > grub-core/osdep/linux/ofpath.c | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c
> > index 1c30e7233..61806212e 100644
> > --- a/grub-core/osdep/linux/ofpath.c
> > +++ b/grub-core/osdep/linux/ofpath.c
> > @@ -389,8 +389,11 @@ of_path_of_nvme(const char *sys_devname __attribute__((unused)),
> >     }
> >
> >   of_path = find_obppath (sysfs_path);
> > +
> > +  if (of_path)
> > +    strcat (of_path, disk);
> > +
> >   free (sysfs_path);
> > -  strcat (of_path, disk);
> >   return of_path;
> > }
> >
> > --
> > 2.16.2
>
> Reviewed-by: Eric Snowberg <eric.snowberg@oracle.com>

Applied. Please CC me next time.

Daniel


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

* Re: [PATCH] ieee1275: Fix crash in of_path_of_nvme when of_path is empty
  2018-03-01 22:34 ` [PATCH] " John Paul Adrian Glaubitz
@ 2018-03-02  3:10   ` Eric Snowberg
  2018-03-05 16:04     ` Daniel Kiper
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Snowberg @ 2018-03-02  3:10 UTC (permalink / raw)
  To: The development of GNU GRUB; +Cc: John Paul Adrian Glaubitz, 891773


> On Mar 1, 2018, at 3:34 PM, John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> wrote:
> 
> The of_path_of_nvme function (commit 2391d57, ieee1275: add nvme
> support within ofpath) introduced a functional regression:
> 
> On systems which are not based on Open Firmware but have at
> least one NVME device, find_obppath will return NULL and thus
> trying to append the disk name to of_path will result in a
> crash.
> 
> The proper behavior of of_path_of_nvme is, however, to just
> return NULL in such cases, like other users of find_obppath,
> such as of_path_of_scsi.
> 
> Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
> ---
> grub-core/osdep/linux/ofpath.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c
> index 1c30e7233..61806212e 100644
> --- a/grub-core/osdep/linux/ofpath.c
> +++ b/grub-core/osdep/linux/ofpath.c
> @@ -389,8 +389,11 @@ of_path_of_nvme(const char *sys_devname __attribute__((unused)),
>     }
> 
>   of_path = find_obppath (sysfs_path);
> +
> +  if (of_path)
> +    strcat (of_path, disk);
> +
>   free (sysfs_path);
> -  strcat (of_path, disk);
>   return of_path;
> }
> 
> -- 
> 2.16.2

Reviewed-by: Eric Snowberg <eric.snowberg@oracle.com>



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

* [PATCH] ieee1275: Fix crash in of_path_of_nvme when of_path is empty
  2018-03-01 22:34 [PATCH v3] " John Paul Adrian Glaubitz
@ 2018-03-01 22:34 ` John Paul Adrian Glaubitz
  2018-03-02  3:10   ` Eric Snowberg
  0 siblings, 1 reply; 8+ messages in thread
From: John Paul Adrian Glaubitz @ 2018-03-01 22:34 UTC (permalink / raw)
  To: grub-devel; +Cc: eric.snowberg, 891773, John Paul Adrian Glaubitz

The of_path_of_nvme function (commit 2391d57, ieee1275: add nvme
support within ofpath) introduced a functional regression:

On systems which are not based on Open Firmware but have at
least one NVME device, find_obppath will return NULL and thus
trying to append the disk name to of_path will result in a
crash.

The proper behavior of of_path_of_nvme is, however, to just
return NULL in such cases, like other users of find_obppath,
such as of_path_of_scsi.

Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
---
 grub-core/osdep/linux/ofpath.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c
index 1c30e7233..61806212e 100644
--- a/grub-core/osdep/linux/ofpath.c
+++ b/grub-core/osdep/linux/ofpath.c
@@ -389,8 +389,11 @@ of_path_of_nvme(const char *sys_devname __attribute__((unused)),
     }
 
   of_path = find_obppath (sysfs_path);
+
+  if (of_path)
+    strcat (of_path, disk);
+
   free (sysfs_path);
-  strcat (of_path, disk);
   return of_path;
 }
 
-- 
2.16.2



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

* [PATCH] ieee1275: Fix crash in of_path_of_nvme when of_path is empty
  2018-03-01 16:00 [PATCH v2] ieee1275: Fix crash in of_path_of_nvme when of_path is empty John Paul Adrian Glaubitz
@ 2018-03-01 16:00 ` John Paul Adrian Glaubitz
  0 siblings, 0 replies; 8+ messages in thread
From: John Paul Adrian Glaubitz @ 2018-03-01 16:00 UTC (permalink / raw)
  To: grub-devel; +Cc: eric.snowberg, 891773, John Paul Adrian Glaubitz

The of_path_of_nvme function (commit 2391d57, ieee1275: add nvme
support within ofpath) introduced a functional regression:

On systems which are not based on Open Firmware but have at
least one NVME device, find_obppath will return an empty path
and appending the disk name to of_path will therefore result
in a crash. Thus, when of_path is empty, just return the
disk name in of_path_of_nvme.

Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
---
 grub-core/osdep/linux/ofpath.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c
index 1c30e7233..da0000f0f 100644
--- a/grub-core/osdep/linux/ofpath.c
+++ b/grub-core/osdep/linux/ofpath.c
@@ -389,8 +389,13 @@ of_path_of_nvme(const char *sys_devname __attribute__((unused)),
     }
 
   of_path = find_obppath (sysfs_path);
+
+  if(of_path)
+    strcat (of_path, disk);
+  else
+    of_path = strdup(disk);
+
   free (sysfs_path);
-  strcat (of_path, disk);
   return of_path;
 }
 
-- 
2.16.2



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

end of thread, other threads:[~2018-03-05 16:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-01 15:47 [PATCH] ieee1275: Fix crash in of_path_of_nvme when of_path is empty John Paul Adrian Glaubitz
2018-03-01 15:47 ` John Paul Adrian Glaubitz
2018-03-01 15:49 ` John Paul Adrian Glaubitz
2018-03-01 15:51   ` Bug#891773: Info received ([PATCH] ieee1275: Fix crash in of_path_of_nvme when of_path is empty) Debian Bug Tracking System
2018-03-01 16:00 [PATCH v2] ieee1275: Fix crash in of_path_of_nvme when of_path is empty John Paul Adrian Glaubitz
2018-03-01 16:00 ` [PATCH] " John Paul Adrian Glaubitz
2018-03-01 22:34 [PATCH v3] " John Paul Adrian Glaubitz
2018-03-01 22:34 ` [PATCH] " John Paul Adrian Glaubitz
2018-03-02  3:10   ` Eric Snowberg
2018-03-05 16:04     ` 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.