diff options
author | Marta Rybczynska <rybczynska@gmail.com> | 2022-02-18 11:05:11 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-03-02 00:21:36 +0000 |
commit | 058d20254f246bba2f1c23b63347ec351a0a919d (patch) | |
tree | 6dcda39c82018dbf01db12c20c0cf8128ab81e4a /meta/recipes-bsp | |
parent | 6b514d38b7fb7300a88e4ac7d357673bf3a3178e (diff) | |
download | poky-058d20254f246bba2f1c23b63347ec351a0a919d.tar.gz |
grub: fix a dangling memory pointer
This change fixes a dangling memory pointer in the grub TFTP code.
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: 17a06ced4ed9305e0a4064bdaad49e653c18284b)
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/0003-net-tftp-Fix-dangling-memory-pointer.patch | 33 | ||||
-rw-r--r-- | meta/recipes-bsp/grub/grub2.inc | 1 |
2 files changed, 34 insertions, 0 deletions
diff --git a/meta/recipes-bsp/grub/files/0003-net-tftp-Fix-dangling-memory-pointer.patch b/meta/recipes-bsp/grub/files/0003-net-tftp-Fix-dangling-memory-pointer.patch new file mode 100644 index 0000000000..3b4633507d --- /dev/null +++ b/meta/recipes-bsp/grub/files/0003-net-tftp-Fix-dangling-memory-pointer.patch | |||
@@ -0,0 +1,33 @@ | |||
1 | From 09cc0df477758b60f51fbc0da1dee2f5d54c333d Mon Sep 17 00:00:00 2001 | ||
2 | From: Darren Kenny <darren.kenny@oracle.com> | ||
3 | Date: Fri, 19 Feb 2021 17:12:23 +0000 | ||
4 | Subject: [PATCH] net/tftp: Fix dangling memory pointer | ||
5 | |||
6 | The static code analysis tool, Parfait, reported that the valid of | ||
7 | file->data was left referencing memory that was freed by the call to | ||
8 | grub_free(data) where data was initialized from file->data. | ||
9 | |||
10 | To ensure that there is no unintentional access to this memory | ||
11 | referenced by file->data we should set the pointer to NULL. | ||
12 | |||
13 | Signed-off-by: Darren Kenny <darren.kenny@oracle.com> | ||
14 | Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> | ||
15 | |||
16 | Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/grub.git/commit/?id=0cb838b281a68b536a09681f9557ea6a7ac5da7a] | ||
17 | Signed-off-by: Marta Rybczynska <marta.rybczynska@huawei.com> | ||
18 | --- | ||
19 | grub-core/net/tftp.c | 1 + | ||
20 | 1 file changed, 1 insertion(+) | ||
21 | |||
22 | diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c | ||
23 | index 7d90bf6..f76b19f 100644 | ||
24 | --- a/grub-core/net/tftp.c | ||
25 | +++ b/grub-core/net/tftp.c | ||
26 | @@ -468,6 +468,7 @@ tftp_close (struct grub_file *file) | ||
27 | } | ||
28 | destroy_pq (data); | ||
29 | grub_free (data); | ||
30 | + file->data = NULL; | ||
31 | return GRUB_ERR_NONE; | ||
32 | } | ||
33 | |||
diff --git a/meta/recipes-bsp/grub/grub2.inc b/meta/recipes-bsp/grub/grub2.inc index 2c0bff8fd0..678aa5c4e2 100644 --- a/meta/recipes-bsp/grub/grub2.inc +++ b/meta/recipes-bsp/grub/grub2.inc | |||
@@ -49,6 +49,7 @@ SRC_URI = "${GNU_MIRROR}/grub/grub-${PV}.tar.gz \ | |||
49 | file://CVE-2020-25647.patch \ | 49 | file://CVE-2020-25647.patch \ |
50 | file://0001-mmap-Fix-memory-leak-when-iterating-over-mapped-memo.patch \ | 50 | file://0001-mmap-Fix-memory-leak-when-iterating-over-mapped-memo.patch \ |
51 | file://0002-net-net-Fix-possible-dereference-to-of-a-NULL-pointe.patch \ | 51 | file://0002-net-net-Fix-possible-dereference-to-of-a-NULL-pointe.patch \ |
52 | file://0003-net-tftp-Fix-dangling-memory-pointer.patch \ | ||
52 | " | 53 | " |
53 | SRC_URI[md5sum] = "5ce674ca6b2612d8939b9e6abed32934" | 54 | SRC_URI[md5sum] = "5ce674ca6b2612d8939b9e6abed32934" |
54 | SRC_URI[sha256sum] = "f10c85ae3e204dbaec39ae22fa3c5e99f0665417e91c2cb49b7e5031658ba6ea" | 55 | SRC_URI[sha256sum] = "f10c85ae3e204dbaec39ae22fa3c5e99f0665417e91c2cb49b7e5031658ba6ea" |