From 54ba1dbbe9a535898283777775d5a6681a62b14f Mon Sep 17 00:00:00 2001 From: gr embeter Date: Thu, 21 Jul 2022 17:30:46 +0200 Subject: efivar: fix import functionality "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 (From OE-Core rev: 27f263a9c69b711f39287c0dc8970ad41758fbb9) Signed-off-by: Grygorii Tertychnyi Signed-off-by: Alexandre Belloni Signed-off-by: Richard Purdie --- .../efivar/0001-Fix-invalid-free-in-main.patch | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 meta/recipes-bsp/efivar/efivar/0001-Fix-invalid-free-in-main.patch (limited to 'meta/recipes-bsp/efivar/efivar') 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 0000000000..7e63df578e --- /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 +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 +Upstream-Status: Backport +Link: https://github.com/rhboot/efivar/commit/6be2cb1c0139ac177e754b0767abf1ca1533847f +Signed-off-by: Grygorii Tertychnyi + +--- + 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; + -- cgit v1.2.3-54-g00ecf