[U-Boot] [BUG] efi_driver: crash while reading from iSCSI drive

AKASHI Takahiro takahiro.akashi at linaro.org
Wed Oct 23 10:30:22 UTC 2019


On Tue, Oct 22, 2019 at 10:29:09PM +0200, Heinrich Schuchardt wrote:
> The patch
> 
> commit 867400677cda0fac4a411f1549fe3a61bb5ed172
> efi_loader: disk: install FILE_SYSTEM_PROTOCOL only if available
> 
> breaks booting my Pine A64 LTS board via iPXE and GRUB. But I assume
> this is not at the base of the problem.
> 
> My iSCSI drive is partitioned like this:
> 
> Device        Boot    Start      End  Sectors  Size Id Type
> pine-a64-lts1          2048   194559   192512   94M ef EFI   vfat
> pine-a64-lts2 *      194560  2148351  1953792  954M 83 Linux ext2
> pine-a64-lts3       2148352 25585663 23437312 11.2G 83 Linux ext4
> pine-a64-lts4      25585664 67106815 41521152 19.8G 83 Linux ext4
> 
> Looking at the debug output below the following questions arise:
> 
> Why is ext2 not recognized as a file system?
> Why is the system crashing when trying to read 1024 blocks from the ext4
> partition?

Try the workaround attached below.
It seems that some fields, particularly log2blksz, in blk_dev held by
ext_fs(of ext_filesystem in fs/ext4/ext4fs.c) are not initialized.

I think that ext4's initialization code should be reworked.

-Takahiro Akashi

diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index 861fcaf3747f..0792e53b32c6 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -337,6 +337,12 @@ static efi_status_t efi_disk_add_dev(
 			       diskobj->dp);
 	if (ret != EFI_SUCCESS)
 		return ret;
+	if (!part) {
+		char buf[10];
+
+		sprintf(buf, "%d:%d", dev_index, part);
+		fs_set_blk_dev(if_typename, buf, FS_TYPE_ANY);
+	}
 	if (part >= 1 && efi_fs_exists(desc, part)) {
 		diskobj->volume = efi_simple_file_system(desc, part,
 							 diskobj->dp);


More information about the U-Boot mailing list