diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2024-03-04 20:00:20 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2024-03-05 16:28:06 +0100 |
commit | e0e30f6362429f2e4510f90f7a677d797aa6087b (patch) | |
tree | b3a1c2849c27019a6a3f8ee263d0dbcde3857845 | |
parent | 7584e768f48af6035f5cf7257ff8f01d4f8d7b56 (diff) | |
download | barebox-e0e30f636242.tar.gz barebox-e0e30f636242.tar.xz |
efi: payload: protect against buggy EFI implementations
barebox' EFI loaded image handle should have a device path, but on the
off-case that it doesn't, we should just return an error code instead of
dereferencing a null pointer.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20240304190038.3486881-96-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | efi/payload/init.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/efi/payload/init.c b/efi/payload/init.c index 0f518d4954..5701d7ad6d 100644 --- a/efi/payload/init.c +++ b/efi/payload/init.c @@ -328,6 +328,9 @@ static int efi_postcore_init(void) loaded_image_dp = device_path_from_handle(efi_loaded_image->device_handle); pr_debug("loaded-image: %pD\n", loaded_image_dp); + if (!loaded_image_dp) + return -EINVAL; + uuid = device_path_to_partuuid(loaded_image_dp); if (uuid) { wchar_t *uuid16 = xstrdup_char_to_wchar(uuid); |