[U-Boot,1/1] efi_loader: fix EFI_FILE_PROTOCOL.GetInfo()

Message ID 20190209212348.30376-1-xypron.glpk@gmx.de
State Accepted
Commit 823c233b7ab95169ea4428b2821b72b8887b47b0
Delegated to: Alexander Graf
Headers show
  • [U-Boot,1/1] efi_loader: fix EFI_FILE_PROTOCOL.GetInfo()
Related show

Commit Message

Heinrich Schuchardt Feb. 9, 2019, 9:23 p.m.
We check the existence of files with fs_exist(). This function calls
fs_close(). If we do not set the active block device again fs_opendir()
fails and we do not set the flag EFI_FILE_DIRECTORY. Due to this error the
`cd` command in the EFI shell fails.

So let's add the missing set_blk_dev(fh) call.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
 lib/efi_loader/efi_file.c | 4 ++++
 1 file changed, 4 insertions(+)


diff --git a/lib/efi_loader/efi_file.c b/lib/efi_loader/efi_file.c
index 1341f1b456..c949275ae2 100644
--- a/lib/efi_loader/efi_file.c
+++ b/lib/efi_loader/efi_file.c
@@ -200,6 +200,10 @@  static struct efi_file_handle *file_open(struct file_system *fs,
 			goto error;
+		/* fs_exists() calls fs_close(), so open file system again */
+		if (set_blk_dev(fh))
+			goto error;
 		/* figure out if file is a directory: */
 		fh->isdir = is_dir(fh);
 	} else {