[PATCH 094/112] efi: payload: protect against buggy EFI implementations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 efi/payload/init.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/efi/payload/init.c b/efi/payload/init.c
index 354120b11a86..b312866cb1f6 100644
--- a/efi/payload/init.c
+++ b/efi/payload/init.c
@@ -327,6 +327,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);
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux