shim: fix OVMF crash

- httpboot.o cannot be built if ".PRECIOUS: " is placed ahead
  of "<tab>CFLAGS +=".
- uri pointer should not be freed if NULL.

Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
This commit is contained in:
Lans Zhang
2017-06-30 17:06:07 +08:00
parent dcfd67c60b
commit 5233d3cf5e
3 changed files with 45 additions and 13 deletions
@@ -1,7 +1,7 @@
From 1f03018aa0b7df2eab576d410ec88e8cf66b06e0 Mon Sep 17 00:00:00 2001
From 8cfbeee2979f0049bf018f207afc01b55d1a7bcd Mon Sep 17 00:00:00 2001
From: Lans Zhang <jia.zhang@windriver.com>
Date: Wed, 21 Sep 2016 11:25:14 +0800
Subject: [PATCH 06/11] Prevent from removing intermediate .efi
Date: Fri, 30 Jun 2017 16:59:34 +0800
Subject: [PATCH] Prevent from removing intermediate .efi
Upstream-Status: Pending
@@ -16,18 +16,18 @@ Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
1 file changed, 2 insertions(+)
diff --git a/Makefile b/Makefile
index efab050..7c71993 100644
index 0497e4d..19e1b4f 100644
--- a/Makefile
+++ b/Makefile
@@ -100,6 +100,8 @@ MOK_SOURCES = MokManager.c shim.h include/console.h PasswordCrypt.c PasswordCryp
FALLBACK_OBJS = fallback.o
FALLBACK_SRCS = fallback.c
@@ -108,6 +108,8 @@ ifneq ($(origin ENABLE_HTTPBOOT), undefined)
SOURCES += httpboot.c httpboot.h
endif
+.PRECIOUS: $(MMNAME).efi $(FBNAME).efi
+
ifneq ($(origin ENABLE_HTTPBOOT), undefined)
OBJS += httpboot.o
SOURCES += httpboot.c httpboot.h
all: $(TARGET)
shim.crt shim.key:
--
2.11.0
2.7.5
@@ -0,0 +1,32 @@
From 9c1636249d1bb8e0e7d108309b2747c6ede62cbb Mon Sep 17 00:00:00 2001
From: Lans Zhang <jia.zhang@windriver.com>
Date: Fri, 30 Jun 2017 15:50:24 +0800
Subject: [PATCH] httpboot: fix OVMF crash
This is a typical typo. The free operation should be done if uri
was allocated.
Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
---
httpboot.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/httpboot.c b/httpboot.c
index f8fbc73..e4657c1 100644
--- a/httpboot.c
+++ b/httpboot.c
@@ -110,8 +110,10 @@ find_httpboot (EFI_HANDLE device)
URI_DEVICE_PATH *UriNode;
UINTN uri_size;
- if (!uri)
+ if (uri) {
FreePool(uri);
+ uri = NULL;
+ }
devpath = DevicePathFromHandle(device);
if (!devpath) {
--
2.7.5
@@ -28,6 +28,7 @@ SRC_URI = "\
file://0010-Makefile-do-not-sign-the-efi-file.patch \
file://0011-Update-verification_method-if-the-loaded-image-is-si.patch;apply=0 \
file://0012-netboot-replace-the-depreciated-EFI_PXE_BASE_CODE.patch \
file://0013-httpboot-fix-OVMF-crash.patch \
"
SRC_URI_append_x86-64 = "\
${@bb.utils.contains('DISTRO_FEATURES', 'msft', \
@@ -35,7 +36,7 @@ SRC_URI_append_x86-64 = "\
if uks_signing_model(d) == 'sample' else '', '', d)} \
"
SRCREV = "55c65546e46a78edbe41e88cb4ccbd2522e09625"
SRCREV = "919c17a45fe722dcc2b9bdaba538c738f97f88cd"
S = "${WORKDIR}/git"
@@ -57,7 +58,6 @@ EXTRA_OEMAKE = "\
AR=${AR} \
${@'VENDOR_CERT_FILE=${WORKDIR}/vendor_cert.cer' if d.getVar('MOK_SB', True) == '1' else ''} \
${@'VENDOR_DBX_FILE=${WORKDIR}/vendor_dbx.esl' if uks_signing_model(d) == 'user' else ''} \
ENABLE_HTTPBOOT=1 \
"
PARALLEL_MAKE = ""