All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] efi: avoid NULL dereference if FilePath is NULL
       [not found] <20190416230117.t6y4yf555m5f3lp5@bivouac.eciton.net>
@ 2019-04-17  5:12 ` Heinrich Schuchardt
  2019-04-18 10:37   ` Daniel Kiper
  0 siblings, 1 reply; 2+ messages in thread
From: Heinrich Schuchardt @ 2019-04-17  5:12 UTC (permalink / raw)
  To: Daniel Kiper
  Cc: Vladimir Serbinenko, Leif Lindholm, grub-devel, bug-grub,
	Heinrich Schuchardt

The UEFI specification allows LoadImage() to be called with a memory
location only and without a device path. In this case FilePath will not be
set in the EFI_LOADED_IMAGE_PROTOCOL.

So in function grub_efi_get_filename() the device path argument may be
NULL. As we cannot determine the device path in this case just return NULL
from the function.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
---
Resend
Cc: grub-devel@gnu.org
---
 grub-core/kern/efi/efi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
index 708581fcb..84e68cf31 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -327,6 +327,9 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0)
   grub_size_t filesize = 0;
   grub_efi_device_path_t *dp;

+  if (!dp0)
+    return NULL;
+
   dp = dp0;

   while (1)
--
2.20.1



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

* Re: [PATCH 1/1] efi: avoid NULL dereference if FilePath is NULL
  2019-04-17  5:12 ` [PATCH 1/1] efi: avoid NULL dereference if FilePath is NULL Heinrich Schuchardt
@ 2019-04-18 10:37   ` Daniel Kiper
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Kiper @ 2019-04-18 10:37 UTC (permalink / raw)
  To: Heinrich Schuchardt
  Cc: Vladimir Serbinenko, Leif Lindholm, grub-devel, bug-grub

On Wed, Apr 17, 2019 at 07:12:56AM +0200, Heinrich Schuchardt wrote:
> The UEFI specification allows LoadImage() to be called with a memory
> location only and without a device path. In this case FilePath will not be
> set in the EFI_LOADED_IMAGE_PROTOCOL.
>
> So in function grub_efi_get_filename() the device path argument may be
> NULL. As we cannot determine the device path in this case just return NULL
> from the function.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>

Daniel


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

end of thread, other threads:[~2019-04-18 10:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20190416230117.t6y4yf555m5f3lp5@bivouac.eciton.net>
2019-04-17  5:12 ` [PATCH 1/1] efi: avoid NULL dereference if FilePath is NULL Heinrich Schuchardt
2019-04-18 10:37   ` 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.