aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2018-09-13 21:31:49 +0200
committerAlexander Graf <agraf@suse.de>2018-09-23 21:55:30 +0200
commitbd66588657e827904b09034957e9d5a1f9d75bac (patch)
tree70782260e725077ed2f5ba64f3c31c009d0ac262 /lib
parent1c381cebb7a67ad2b55e8271bbe344baf060cb85 (diff)
downloadu-boot-bd66588657e827904b09034957e9d5a1f9d75bac.zip
u-boot-bd66588657e827904b09034957e9d5a1f9d75bac.tar.gz
u-boot-bd66588657e827904b09034957e9d5a1f9d75bac.tar.bz2
efi_loader: loosen check of parameters of efi_file_open()
The UEFI spec requires that attributes are only set for when EFI_FILE_MODE_CREATE is set in open_mode. The SCT tries to read a directory with EFI_FILE_DIRECTORY. As EDK2 allows this we should not be more strict. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_loader/efi_file.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/efi_loader/efi_file.c b/lib/efi_loader/efi_file.c
index 9ba7673..84be0d5 100644
--- a/lib/efi_loader/efi_file.c
+++ b/lib/efi_loader/efi_file.c
@@ -229,7 +229,16 @@ static efi_status_t EFIAPI efi_file_open(struct efi_file_handle *file,
ret = EFI_INVALID_PARAMETER;
goto out;
}
- if ((!(open_mode & EFI_FILE_MODE_CREATE) && attributes) ||
+ /*
+ * The UEFI spec requires that attributes are only set in create mode.
+ * The SCT does not care about this and sets EFI_FILE_DIRECTORY in
+ * read mode. EDK2 does not check that attributes are zero if not in
+ * create mode.
+ *
+ * So here we only check attributes in create mode and do not check
+ * that they are zero otherwise.
+ */
+ if ((open_mode & EFI_FILE_MODE_CREATE) &&
(attributes & (EFI_FILE_READ_ONLY | ~EFI_FILE_VALID_ATTR))) {
ret = EFI_INVALID_PARAMETER;
goto out;