diff options
author | Marta Rybczynska <rybczynska@gmail.com> | 2022-02-18 11:05:49 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-03-02 00:21:37 +0000 |
commit | 1a338ab46649328617df0a507663b3ca3d61110a (patch) | |
tree | aaee4111ed9f251df225eb89cef2938c5c153cf9 | |
parent | d65bf404bc800a58b12f9e973bc99908f9684cee (diff) | |
download | poky-1a338ab46649328617df0a507663b3ca3d61110a.tar.gz |
grub: add a fix for NULL pointer dereference
This patch adds a fix for a NULL pointer dereference in grub's
util/grub-install. 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: 35310bcfd53752081ed600e77f58ca3fb8db46ac)
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>
-rw-r--r-- | meta/recipes-bsp/grub/files/0041-util-grub-install-Fix-NULL-pointer-dereferences.patch | 41 | ||||
-rw-r--r-- | meta/recipes-bsp/grub/grub2.inc | 1 |
2 files changed, 42 insertions, 0 deletions
diff --git a/meta/recipes-bsp/grub/files/0041-util-grub-install-Fix-NULL-pointer-dereferences.patch b/meta/recipes-bsp/grub/files/0041-util-grub-install-Fix-NULL-pointer-dereferences.patch new file mode 100644 index 0000000000..ea563a41a0 --- /dev/null +++ b/meta/recipes-bsp/grub/files/0041-util-grub-install-Fix-NULL-pointer-dereferences.patch | |||
@@ -0,0 +1,41 @@ | |||
1 | From 5d2dd0052474a882a22e47cc8c3ed87a01819f6b Mon Sep 17 00:00:00 2001 | ||
2 | From: Daniel Kiper <daniel.kiper@oracle.com> | ||
3 | Date: Thu, 25 Feb 2021 18:35:01 +0100 | ||
4 | Subject: [PATCH] util/grub-install: Fix NULL pointer dereferences | ||
5 | |||
6 | Two grub_device_open() calls does not have associated NULL checks | ||
7 | for returned values. Fix that and appease the Coverity. | ||
8 | |||
9 | Fixes: CID 314583 | ||
10 | |||
11 | Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com> | ||
12 | Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> | ||
13 | |||
14 | Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/grub.git/commit/?id=8b3a95655b4391122e7b0315d8cc6f876caf8183] | ||
15 | Signed-off-by: Marta Rybczynska <marta.rybczynska@huawei.com> | ||
16 | --- | ||
17 | util/grub-install.c | 4 ++++ | ||
18 | 1 file changed, 4 insertions(+) | ||
19 | |||
20 | diff --git a/util/grub-install.c b/util/grub-install.c | ||
21 | index a82725f..367350f 100644 | ||
22 | --- a/util/grub-install.c | ||
23 | +++ b/util/grub-install.c | ||
24 | @@ -1775,6 +1775,8 @@ main (int argc, char *argv[]) | ||
25 | fill_core_services (core_services); | ||
26 | |||
27 | ins_dev = grub_device_open (install_drive); | ||
28 | + if (ins_dev == NULL) | ||
29 | + grub_util_error ("%s", grub_errmsg); | ||
30 | |||
31 | bless (ins_dev, core_services, 0); | ||
32 | |||
33 | @@ -1875,6 +1877,8 @@ main (int argc, char *argv[]) | ||
34 | fill_core_services(core_services); | ||
35 | |||
36 | ins_dev = grub_device_open (install_drive); | ||
37 | + if (ins_dev == NULL) | ||
38 | + grub_util_error ("%s", grub_errmsg); | ||
39 | |||
40 | bless (ins_dev, boot_efi, 1); | ||
41 | if (!removable && update_nvram) | ||
diff --git a/meta/recipes-bsp/grub/grub2.inc b/meta/recipes-bsp/grub/grub2.inc index fad7415e0d..7ca0b469e9 100644 --- a/meta/recipes-bsp/grub/grub2.inc +++ b/meta/recipes-bsp/grub/grub2.inc | |||
@@ -87,6 +87,7 @@ SRC_URI = "${GNU_MIRROR}/grub/grub-${PV}.tar.gz \ | |||
87 | file://0038-loader-xnu-Fix-memory-leak.patch \ | 87 | file://0038-loader-xnu-Fix-memory-leak.patch \ |
88 | file://0039-loader-xnu-Free-driverkey-data-when-an-error-is-dete.patch \ | 88 | file://0039-loader-xnu-Free-driverkey-data-when-an-error-is-dete.patch \ |
89 | file://0040-loader-xnu-Check-if-pointer-is-NULL-before-using-it.patch \ | 89 | file://0040-loader-xnu-Check-if-pointer-is-NULL-before-using-it.patch \ |
90 | file://0041-util-grub-install-Fix-NULL-pointer-dereferences.patch \ | ||
90 | " | 91 | " |
91 | SRC_URI[md5sum] = "5ce674ca6b2612d8939b9e6abed32934" | 92 | SRC_URI[md5sum] = "5ce674ca6b2612d8939b9e6abed32934" |
92 | SRC_URI[sha256sum] = "f10c85ae3e204dbaec39ae22fa3c5e99f0665417e91c2cb49b7e5031658ba6ea" | 93 | SRC_URI[sha256sum] = "f10c85ae3e204dbaec39ae22fa3c5e99f0665417e91c2cb49b7e5031658ba6ea" |