diff options
| author | Marta Rybczynska <rybczynska@gmail.com> | 2022-02-18 11:05:36 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-03-02 00:21:37 +0000 |
| commit | 4c7bfa8abe03620105a207f74529e07b5ad4ae7d (patch) | |
| tree | b3efd3e0b720dbf9e533c247412921bea4cc2922 /meta/recipes-bsp | |
| parent | b46710743b356734f1ec4fbfa6dbc56eb2329bf5 (diff) | |
| download | poky-4c7bfa8abe03620105a207f74529e07b5ad4ae7d.tar.gz | |
grub: add a fix for a memory leak
This patch fixes a memory leak in grub's syslinux parsing. 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: a9d0155842f0582a0d247c81bf972661f0a2cda8)
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/0028-syslinux-Fix-memory-leak-while-parsing.patch | 43 | ||||
| -rw-r--r-- | meta/recipes-bsp/grub/grub2.inc | 1 |
2 files changed, 44 insertions, 0 deletions
diff --git a/meta/recipes-bsp/grub/files/0028-syslinux-Fix-memory-leak-while-parsing.patch b/meta/recipes-bsp/grub/files/0028-syslinux-Fix-memory-leak-while-parsing.patch new file mode 100644 index 0000000000..d8c21d88f7 --- /dev/null +++ b/meta/recipes-bsp/grub/files/0028-syslinux-Fix-memory-leak-while-parsing.patch | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | From ea12feb69b6af93c7e2fa03df7ac3bd1f4edd599 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Darren Kenny <darren.kenny@oracle.com> | ||
| 3 | Date: Thu, 26 Nov 2020 15:31:53 +0000 | ||
| 4 | Subject: [PATCH] syslinux: Fix memory leak while parsing | ||
| 5 | |||
| 6 | In syslinux_parse_real() the 2 points where return is being called | ||
| 7 | didn't release the memory stored in buf which is no longer required. | ||
| 8 | |||
| 9 | Fixes: CID 176634 | ||
| 10 | |||
| 11 | Signed-off-by: Darren Kenny <darren.kenny@oracle.com> | ||
| 12 | Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> | ||
| 13 | |||
| 14 | Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/grub.git/commit/?id=95bc016dba94cab3d398dd74160665915cd08ad6] | ||
| 15 | Signed-off-by: Marta Rybczynska <marta.rybczynska@huawei.com> | ||
| 16 | --- | ||
| 17 | grub-core/lib/syslinux_parse.c | 6 +++++- | ||
| 18 | 1 file changed, 5 insertions(+), 1 deletion(-) | ||
| 19 | |||
| 20 | diff --git a/grub-core/lib/syslinux_parse.c b/grub-core/lib/syslinux_parse.c | ||
| 21 | index 4afa992..3acc6b4 100644 | ||
| 22 | --- a/grub-core/lib/syslinux_parse.c | ||
| 23 | +++ b/grub-core/lib/syslinux_parse.c | ||
| 24 | @@ -737,7 +737,10 @@ syslinux_parse_real (struct syslinux_menu *menu) | ||
| 25 | && grub_strncasecmp ("help", ptr3, ptr4 - ptr3) == 0)) | ||
| 26 | { | ||
| 27 | if (helptext (ptr5, file, menu)) | ||
| 28 | - return 1; | ||
| 29 | + { | ||
| 30 | + grub_free (buf); | ||
| 31 | + return 1; | ||
| 32 | + } | ||
| 33 | continue; | ||
| 34 | } | ||
| 35 | |||
| 36 | @@ -757,6 +760,7 @@ syslinux_parse_real (struct syslinux_menu *menu) | ||
| 37 | } | ||
| 38 | fail: | ||
| 39 | grub_file_close (file); | ||
| 40 | + grub_free (buf); | ||
| 41 | return err; | ||
| 42 | } | ||
| 43 | |||
diff --git a/meta/recipes-bsp/grub/grub2.inc b/meta/recipes-bsp/grub/grub2.inc index ef409bdd6a..c965f0fd15 100644 --- a/meta/recipes-bsp/grub/grub2.inc +++ b/meta/recipes-bsp/grub/grub2.inc | |||
| @@ -74,6 +74,7 @@ SRC_URI = "${GNU_MIRROR}/grub/grub-${PV}.tar.gz \ | |||
| 74 | file://0025-affs-Fix-memory-leaks.patch \ | 74 | file://0025-affs-Fix-memory-leaks.patch \ |
| 75 | file://0026-libgcrypt-mpi-Fix-possible-unintended-sign-extension.patch \ | 75 | file://0026-libgcrypt-mpi-Fix-possible-unintended-sign-extension.patch \ |
| 76 | file://0027-libgcrypt-mpi-Fix-possible-NULL-dereference.patch \ | 76 | file://0027-libgcrypt-mpi-Fix-possible-NULL-dereference.patch \ |
| 77 | file://0028-syslinux-Fix-memory-leak-while-parsing.patch \ | ||
| 77 | " | 78 | " |
| 78 | SRC_URI[md5sum] = "5ce674ca6b2612d8939b9e6abed32934" | 79 | SRC_URI[md5sum] = "5ce674ca6b2612d8939b9e6abed32934" |
| 79 | SRC_URI[sha256sum] = "f10c85ae3e204dbaec39ae22fa3c5e99f0665417e91c2cb49b7e5031658ba6ea" | 80 | SRC_URI[sha256sum] = "f10c85ae3e204dbaec39ae22fa3c5e99f0665417e91c2cb49b7e5031658ba6ea" |
