All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] efivar: fix import functionality
@ 2022-07-21 15:30 Grygorii Tertychnyi
  0 siblings, 0 replies; only message in thread
From: Grygorii Tertychnyi @ 2022-07-21 15:30 UTC (permalink / raw)
  To: openembedded-core; +Cc: Grygorii Tertychnyi

"efivar --import" is broken in v38:

 # efivar -i /8be4df61-93ca-11d2-aa0d-00e098032b8c-Timeout
free(): invalid pointer
Aborted

Backport upstream patch to fix it.

Upstream issue:
https://github.com/rhboot/efivar/issues/173

Signed-off-by: Grygorii Tertychnyi <grygorii.tertychnyi@leica-geosystems.com>
---
 .../0001-Fix-invalid-free-in-main.patch       | 30 +++++++++++++++++++
 meta/recipes-bsp/efivar/efivar_38.bb          |  1 +
 2 files changed, 31 insertions(+)
 create mode 100644 meta/recipes-bsp/efivar/efivar/0001-Fix-invalid-free-in-main.patch

diff --git a/meta/recipes-bsp/efivar/efivar/0001-Fix-invalid-free-in-main.patch b/meta/recipes-bsp/efivar/efivar/0001-Fix-invalid-free-in-main.patch
new file mode 100644
index 000000000000..7e63df578e2a
--- /dev/null
+++ b/meta/recipes-bsp/efivar/efivar/0001-Fix-invalid-free-in-main.patch
@@ -0,0 +1,30 @@
+From 085f027e9e9f1478f68ddda705f83b244ee3bd88 Mon Sep 17 00:00:00 2001
+From: Robbie Harwood <rharwood@redhat.com>
+Date: Mon, 18 Apr 2022 13:08:18 -0400
+Subject: [PATCH] Fix invalid free in main()
+
+data is allocated by mmap() in prepare_data().
+
+Resolves: #173
+Signed-off-by: Robbie Harwood <rharwood@redhat.com>
+Upstream-Status: Backport
+Link: https://github.com/rhboot/efivar/commit/6be2cb1c0139ac177e754b0767abf1ca1533847f
+Signed-off-by: Grygorii Tertychnyi <grygorii.tertychnyi@leica-geosystems.com>
+
+---
+ src/efivar.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/efivar.c b/src/efivar.c
+index 5cd1eb2bc73c..09f85edd0a38 100644
+--- a/src/efivar.c
++++ b/src/efivar.c
+@@ -633,7 +633,7 @@ int main(int argc, char *argv[])
+ 				if (sz < 0)
+ 					err(1, "Could not import data from \"%s\"", infile);
+ 
+-				free(data);
++				munmap(data, data_size);
+ 				data = NULL;
+ 				data_size = 0;
+ 
diff --git a/meta/recipes-bsp/efivar/efivar_38.bb b/meta/recipes-bsp/efivar/efivar_38.bb
index 53fe20a95b91..42625fa041f2 100644
--- a/meta/recipes-bsp/efivar/efivar_38.bb
+++ b/meta/recipes-bsp/efivar/efivar_38.bb
@@ -11,6 +11,7 @@ SRC_URI = "git://github.com/rhinstaller/efivar.git;branch=main;protocol=https \
            file://0001-docs-do-not-build-efisecdb-manpage.patch \
            file://0001-src-Makefile-build-util.c-separately-for-makeguids.patch \
            file://efisecdb-fix-build-with-musl-libc.patch \
+           file://0001-Fix-invalid-free-in-main.patch \
            "
 SRCREV = "1753149d4176ebfb2b135ac0aaf79340bf0e7a93"
 
-- 
2.35.1



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-21 15:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-21 15:30 [PATCH] efivar: fix import functionality Grygorii Tertychnyi

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.