[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200517125754.8934-2-ardb@kernel.org>
Date: Sun, 17 May 2020 14:57:48 +0200
From: Ard Biesheuvel <ardb@...nel.org>
To: linux-efi@...r.kernel.org, Ingo Molnar <mingo@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>
Cc: Ard Biesheuvel <ardb@...nel.org>, linux-kernel@...r.kernel.org,
Arvind Sankar <nivedita@...m.mit.edu>,
Benjamin Thiel <b.thiel@...teo.de>,
Borislav Petkov <bp@...en8.de>, Dave Young <dyoung@...hat.com>,
Heinrich Schuchardt <xypron.glpk@....de>,
Javier Martinez Canillas <javierm@...hat.com>,
Jerry Snitselaar <jsnitsel@...hat.com>,
Lenny Szubowicz <lszubowi@...hat.com>,
linux-acpi@...r.kernel.org, Loic Yhuel <loic.yhuel@...il.com>,
Matthew Garrett <mjg59@...gle.com>,
Mike Lothian <mike@...eburn.co.uk>,
Punit Agrawal <punit1.agrawal@...hiba.co.jp>
Subject: [PATCH 1/7] efi/libstub: Avoid returning uninitialized data from setup_graphics()
From: Heinrich Schuchardt <xypron.glpk@....de>
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@....de>
Link: https://lore.kernel.org/r/20200426194946.112768-1-xypron.glpk@gmx.de
Signed-off-by: Ard Biesheuvel <ardb@...nel.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 99a5cde7c2d8..48161b1dd098 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;
}
--
2.17.1
Powered by blists - more mailing lists