All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] efi/libstub: setup_graphics() do not return random data
@ 2020-04-26 19:49 Heinrich Schuchardt
  2020-04-27  6:52 ` Ard Biesheuvel
  2020-05-22 18:30 ` [tip: efi/urgent] efi/libstub: Avoid returning uninitialized data from setup_graphics() tip-bot2 for Heinrich Schuchardt
  0 siblings, 2 replies; 3+ messages in thread
From: Heinrich Schuchardt @ 2020-04-26 19:49 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: Ingo Molnar, linux-efi, linux-kernel, Heinrich Schuchardt

Currently setup_graphics() ignores the return value of efi_setup_gop(). As
AllocatePool() does not zero out memory the screen information table will
contain random data in this case.

We should free the screen information table if efi_setup_gop() returns an
error code.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 drivers/firmware/efi/libstub/efi-stub.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/libstub/efi-stub.c b/drivers/firmware/efi/libstub/efi-stub.c
index ee225b323687..60377e5ceab3 100644
--- a/drivers/firmware/efi/libstub/efi-stub.c
+++ b/drivers/firmware/efi/libstub/efi-stub.c
@@ -55,7 +55,11 @@ static struct screen_info *setup_graphics(void)
 		si = alloc_screen_info();
 		if (!si)
 			return NULL;
-		efi_setup_gop(si, &gop_proto, size);
+		status = efi_setup_gop(si, &gop_proto, size);
+		if (status != EFI_SUCCESS) {
+			free_screen_info(si);
+			return NULL;
+		}
 	}
 	return si;
 }
--
2.26.2


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

* Re: [PATCH 1/1] efi/libstub: setup_graphics() do not return random data
  2020-04-26 19:49 [PATCH 1/1] efi/libstub: setup_graphics() do not return random data Heinrich Schuchardt
@ 2020-04-27  6:52 ` Ard Biesheuvel
  2020-05-22 18:30 ` [tip: efi/urgent] efi/libstub: Avoid returning uninitialized data from setup_graphics() tip-bot2 for Heinrich Schuchardt
  1 sibling, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2020-04-27  6:52 UTC (permalink / raw)
  To: Heinrich Schuchardt; +Cc: Ingo Molnar, linux-efi, Linux Kernel Mailing List

On Sun, 26 Apr 2020 at 21:49, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> Currently setup_graphics() ignores the return value of efi_setup_gop(). As
> AllocatePool() does not zero out memory the screen information table will
> contain random data in this case.
>
> We should free the screen information table if efi_setup_gop() returns an
> error code.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

Thanks Heinrich

I will take this as a fix


> ---
>  drivers/firmware/efi/libstub/efi-stub.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/firmware/efi/libstub/efi-stub.c b/drivers/firmware/efi/libstub/efi-stub.c
> index ee225b323687..60377e5ceab3 100644
> --- a/drivers/firmware/efi/libstub/efi-stub.c
> +++ b/drivers/firmware/efi/libstub/efi-stub.c
> @@ -55,7 +55,11 @@ static struct screen_info *setup_graphics(void)
>                 si = alloc_screen_info();
>                 if (!si)
>                         return NULL;
> -               efi_setup_gop(si, &gop_proto, size);
> +               status = efi_setup_gop(si, &gop_proto, size);
> +               if (status != EFI_SUCCESS) {
> +                       free_screen_info(si);
> +                       return NULL;
> +               }
>         }
>         return si;
>  }
> --
> 2.26.2
>

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

* [tip: efi/urgent] efi/libstub: Avoid returning uninitialized data from setup_graphics()
  2020-04-26 19:49 [PATCH 1/1] efi/libstub: setup_graphics() do not return random data Heinrich Schuchardt
  2020-04-27  6:52 ` Ard Biesheuvel
@ 2020-05-22 18:30 ` tip-bot2 for Heinrich Schuchardt
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Heinrich Schuchardt @ 2020-05-22 18:30 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Heinrich Schuchardt, Ard Biesheuvel, x86, LKML

The following commit has been merged into the efi/urgent branch of tip:

Commit-ID:     081d5150845ba3fa49151a2f55d3cc03b0987509
Gitweb:        https://git.kernel.org/tip/081d5150845ba3fa49151a2f55d3cc03b0987509
Author:        Heinrich Schuchardt <xypron.glpk@gmx.de>
AuthorDate:    Sun, 26 Apr 2020 21:49:46 +02:00
Committer:     Ard Biesheuvel <ardb@kernel.org>
CommitterDate: Thu, 30 Apr 2020 23:26:30 +02:00

efi/libstub: Avoid returning uninitialized data from setup_graphics()

Currently, setup_graphics() ignores the return value of efi_setup_gop(). As
AllocatePool() does not zero out memory, the screen information table will
contain uninitialized data in this case.

We should free the screen information table if efi_setup_gop() returns an
error code.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Link: https://lore.kernel.org/r/20200426194946.112768-1-xypron.glpk@gmx.de
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 drivers/firmware/efi/libstub/arm-stub.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/libstub/arm-stub.c b/drivers/firmware/efi/libstub/arm-stub.c
index 99a5cde..48161b1 100644
--- a/drivers/firmware/efi/libstub/arm-stub.c
+++ b/drivers/firmware/efi/libstub/arm-stub.c
@@ -60,7 +60,11 @@ static struct screen_info *setup_graphics(void)
 		si = alloc_screen_info();
 		if (!si)
 			return NULL;
-		efi_setup_gop(si, &gop_proto, size);
+		status = efi_setup_gop(si, &gop_proto, size);
+		if (status != EFI_SUCCESS) {
+			free_screen_info(si);
+			return NULL;
+		}
 	}
 	return si;
 }

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

end of thread, other threads:[~2020-05-22 18:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-26 19:49 [PATCH 1/1] efi/libstub: setup_graphics() do not return random data Heinrich Schuchardt
2020-04-27  6:52 ` Ard Biesheuvel
2020-05-22 18:30 ` [tip: efi/urgent] efi/libstub: Avoid returning uninitialized data from setup_graphics() tip-bot2 for Heinrich Schuchardt

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.