diff options
author | Marta Rybczynska <rybczynska@gmail.com> | 2022-02-18 11:05:14 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-03-02 00:21:36 +0000 |
commit | 4a5a4dbcf618b0ba550c91136b5740c8f6f69bb8 (patch) | |
tree | 9c0b6f14eaa7ac169a49785b558e7f83b4085043 /meta/recipes-bsp | |
parent | 763007dff131cc8dc6a7d4dec533e37dad282bd7 (diff) | |
download | poky-4a5a4dbcf618b0ba550c91136b5740c8f6f69bb8.tar.gz |
grub: fix memory leak at error in grub_efi_get_filename()
This change fixes a memory leak on error in grub_efi_get_filename().
It is a part of a security series [1].
[1] https://lists.gnu.org/archive/html/grub-devel/2021-03/msg00007.html
(From OE-Core rev: 1b192247fa913c29f5cdf22abe4e71a509b3861e)
Signed-off-by: Marta Rybczynska <marta.rybczynska@huawei.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-bsp')
-rw-r--r-- | meta/recipes-bsp/grub/files/0006-kern-efi-Fix-memory-leak-on-failure.patch | 30 | ||||
-rw-r--r-- | meta/recipes-bsp/grub/grub2.inc | 1 |
2 files changed, 31 insertions, 0 deletions
diff --git a/meta/recipes-bsp/grub/files/0006-kern-efi-Fix-memory-leak-on-failure.patch b/meta/recipes-bsp/grub/files/0006-kern-efi-Fix-memory-leak-on-failure.patch new file mode 100644 index 0000000000..9d7327cee6 --- /dev/null +++ b/meta/recipes-bsp/grub/files/0006-kern-efi-Fix-memory-leak-on-failure.patch | |||
@@ -0,0 +1,30 @@ | |||
1 | From d4fd0243920b71cc6e03cc0cadf23b4fe03c352f Mon Sep 17 00:00:00 2001 | ||
2 | From: Darren Kenny <darren.kenny@oracle.com> | ||
3 | Date: Thu, 5 Nov 2020 10:15:25 +0000 | ||
4 | Subject: [PATCH] kern/efi: Fix memory leak on failure | ||
5 | |||
6 | Free the memory allocated to name before returning on failure. | ||
7 | |||
8 | Fixes: CID 296222 | ||
9 | |||
10 | Signed-off-by: Darren Kenny <darren.kenny@oracle.com> | ||
11 | Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> | ||
12 | |||
13 | Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/grub.git/commit/?id=ed286ceba6015d37a9304f04602451c47bf195d7] | ||
14 | Signed-off-by: Marta Rybczynska <marta.rybczynska@huawei.com> | ||
15 | --- | ||
16 | grub-core/kern/efi/efi.c | 1 + | ||
17 | 1 file changed, 1 insertion(+) | ||
18 | |||
19 | diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c | ||
20 | index 6a38080..baeeef0 100644 | ||
21 | --- a/grub-core/kern/efi/efi.c | ||
22 | +++ b/grub-core/kern/efi/efi.c | ||
23 | @@ -415,6 +415,7 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0) | ||
24 | { | ||
25 | grub_error (GRUB_ERR_OUT_OF_RANGE, | ||
26 | "malformed EFI Device Path node has length=%d", len); | ||
27 | + grub_free (name); | ||
28 | return NULL; | ||
29 | } | ||
30 | |||
diff --git a/meta/recipes-bsp/grub/grub2.inc b/meta/recipes-bsp/grub/grub2.inc index f7f2aa892f..04ed8b7b23 100644 --- a/meta/recipes-bsp/grub/grub2.inc +++ b/meta/recipes-bsp/grub/grub2.inc | |||
@@ -52,6 +52,7 @@ SRC_URI = "${GNU_MIRROR}/grub/grub-${PV}.tar.gz \ | |||
52 | file://0003-net-tftp-Fix-dangling-memory-pointer.patch \ | 52 | file://0003-net-tftp-Fix-dangling-memory-pointer.patch \ |
53 | file://0004-kern-parser-Fix-resource-leak-if-argc-0.patch \ | 53 | file://0004-kern-parser-Fix-resource-leak-if-argc-0.patch \ |
54 | file://0005-efi-Fix-some-malformed-device-path-arithmetic-errors.patch \ | 54 | file://0005-efi-Fix-some-malformed-device-path-arithmetic-errors.patch \ |
55 | file://0006-kern-efi-Fix-memory-leak-on-failure.patch \ | ||
55 | " | 56 | " |
56 | SRC_URI[md5sum] = "5ce674ca6b2612d8939b9e6abed32934" | 57 | SRC_URI[md5sum] = "5ce674ca6b2612d8939b9e6abed32934" |
57 | SRC_URI[sha256sum] = "f10c85ae3e204dbaec39ae22fa3c5e99f0665417e91c2cb49b7e5031658ba6ea" | 58 | SRC_URI[sha256sum] = "f10c85ae3e204dbaec39ae22fa3c5e99f0665417e91c2cb49b7e5031658ba6ea" |