summaryrefslogtreecommitdiffstats
path: root/meta/recipes-bsp
diff options
context:
space:
mode:
authorMarta Rybczynska <rybczynska@gmail.com>2022-02-18 11:05:10 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-03-02 00:21:36 +0000
commit6b514d38b7fb7300a88e4ac7d357673bf3a3178e (patch)
tree99c218a8effa4d47510b265417b3d9b64b666bee /meta/recipes-bsp
parent01eb48b7f5681f2c4a51ae63243a7c7ccdc8435e (diff)
downloadpoky-6b514d38b7fb7300a88e4ac7d357673bf3a3178e.tar.gz
grub: add a fix for a possible NULL dereference
This fix removes a possible NULL pointer dereference in grub networking 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: 5e62b476b541d3803e537f2228a264224b72cf81) 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/0002-net-net-Fix-possible-dereference-to-of-a-NULL-pointe.patch39
-rw-r--r--meta/recipes-bsp/grub/grub2.inc1
2 files changed, 40 insertions, 0 deletions
diff --git a/meta/recipes-bsp/grub/files/0002-net-net-Fix-possible-dereference-to-of-a-NULL-pointe.patch b/meta/recipes-bsp/grub/files/0002-net-net-Fix-possible-dereference-to-of-a-NULL-pointe.patch
new file mode 100644
index 0000000000..d00821f5c3
--- /dev/null
+++ b/meta/recipes-bsp/grub/files/0002-net-net-Fix-possible-dereference-to-of-a-NULL-pointe.patch
@@ -0,0 +1,39 @@
1From f216a75e884ed5e4e94bf86965000dde51148f94 Mon Sep 17 00:00:00 2001
2From: Darren Kenny <darren.kenny@oracle.com>
3Date: Fri, 27 Nov 2020 15:10:26 +0000
4Subject: [PATCH] net/net: Fix possible dereference to of a NULL pointer
5
6It is always possible that grub_zalloc() could fail, so we should check for
7a NULL return. Otherwise we run the risk of dereferencing a NULL pointer.
8
9Fixes: CID 296221
10
11Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
12Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
13
14Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/grub.git/commit/?id=03f2515ae0c503406f1a99a2178405049c6555db]
15Signed-off-by: Marta Rybczynska <marta.rybczynska@huawei.com>
16---
17 grub-core/net/net.c | 9 +++++++--
18 1 file changed, 7 insertions(+), 2 deletions(-)
19
20diff --git a/grub-core/net/net.c b/grub-core/net/net.c
21index 38f19df..7c2cdf2 100644
22--- a/grub-core/net/net.c
23+++ b/grub-core/net/net.c
24@@ -86,8 +86,13 @@ grub_net_link_layer_add_address (struct grub_net_card *card,
25
26 /* Add sender to cache table. */
27 if (card->link_layer_table == NULL)
28- card->link_layer_table = grub_zalloc (LINK_LAYER_CACHE_SIZE
29- * sizeof (card->link_layer_table[0]));
30+ {
31+ card->link_layer_table = grub_zalloc (LINK_LAYER_CACHE_SIZE
32+ * sizeof (card->link_layer_table[0]));
33+ if (card->link_layer_table == NULL)
34+ return;
35+ }
36+
37 entry = &(card->link_layer_table[card->new_ll_entry]);
38 entry->avail = 1;
39 grub_memcpy (&entry->ll_address, ll, sizeof (entry->ll_address));
diff --git a/meta/recipes-bsp/grub/grub2.inc b/meta/recipes-bsp/grub/grub2.inc
index a06beac5ef..2c0bff8fd0 100644
--- a/meta/recipes-bsp/grub/grub2.inc
+++ b/meta/recipes-bsp/grub/grub2.inc
@@ -48,6 +48,7 @@ SRC_URI = "${GNU_MIRROR}/grub/grub-${PV}.tar.gz \
48 file://CVE-2020-25632.patch \ 48 file://CVE-2020-25632.patch \
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 " 52 "
52SRC_URI[md5sum] = "5ce674ca6b2612d8939b9e6abed32934" 53SRC_URI[md5sum] = "5ce674ca6b2612d8939b9e6abed32934"
53SRC_URI[sha256sum] = "f10c85ae3e204dbaec39ae22fa3c5e99f0665417e91c2cb49b7e5031658ba6ea" 54SRC_URI[sha256sum] = "f10c85ae3e204dbaec39ae22fa3c5e99f0665417e91c2cb49b7e5031658ba6ea"