From 74f5baa28bebf243b372d63a673ddf214cbc50b6 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Wed, 10 Apr 2019 11:02:58 +0200 Subject: [PATCH] efi_loader: add protection for block_dev Check the value of block_dev before to use this pointer. This patch solves problem for the command "load" when ubifs is previously mounted: in this case the function blk_get_device_part_str("ubi 0") don't return error but return block_dev = NULL and then data abort. Signed-off-by: Patrick Delaunay Reviewed-by: Heinrich Schuchardt Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_device_path.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index 1b08ca8..d8c052d 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -968,7 +968,7 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr, if (!is_net) { part = blk_get_device_part_str(dev, devnr, &desc, &fs_partition, 1); - if (part < 0) + if (part < 0 || !desc) return EFI_INVALID_PARAMETER; if (device) -- 2.7.4