summaryrefslogtreecommitdiff
path: root/drivers/firmware
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2014-04-10 14:11:45 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-05-06 07:59:29 -0700
commite504a78c9336d920d48566dc8adcd25f0b5d99b8 (patch)
treed0d5916d2c503e1e31da144c1bd6a42799ace32e /drivers/firmware
parent45ada9fae6d836aa8e3be5302d7aeb50c44e0629 (diff)
efi: Pass correct file handle to efi_file_{read,close}
commit 47514c996fac5e6f13ef3a4c5e23f1c5cffabb7b upstream. We're currently passing the file handle for the root file system to efi_file_read() and efi_file_close(), instead of the file handle for the file we wish to read/close. While this has worked up until now, it seems that it has only been by pure luck. Olivier explains, "The issue is the UEFI Fat driver might return the same function for 'fh->read()' and 'h->read()'. While in our case it does not work with a different implementation of EFI_SIMPLE_FILE_SYSTEM_PROTOCOL. In our case, we return a different pointer when reading a directory and reading a file." Fixing this actually clears up the two functions because we can drop one of the arguments, and instead only pass a file 'handle' argument. Reported-by: Olivier Martin <olivier.martin@arm.com> Reviewed-by: Olivier Martin <olivier.martin@arm.com> Reviewed-by: Mark Rutland <mark.rutland@arm.com> Cc: Leif Lindholm <leif.lindholm@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/firmware')
-rw-r--r--drivers/firmware/efi/efi-stub-helper.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/firmware/efi/efi-stub-helper.c b/drivers/firmware/efi/efi-stub-helper.c
index b6bffbfd3be7..3a74def216a5 100644
--- a/drivers/firmware/efi/efi-stub-helper.c
+++ b/drivers/firmware/efi/efi-stub-helper.c
@@ -468,7 +468,7 @@ grow:
chunksize = EFI_READ_CHUNK_SIZE;
else
chunksize = size;
- status = efi_call_phys3(fh->read,
+ status = efi_call_phys3(files[j].handle->read,
files[j].handle,
&chunksize,
(void *)addr);
@@ -480,7 +480,7 @@ grow:
size -= chunksize;
}
- efi_call_phys1(fh->close, files[j].handle);
+ efi_call_phys1(files[j].handle->close, files[j].handle);
}
}
@@ -497,7 +497,7 @@ free_file_total:
close_handles:
for (k = j; k < i; k++)
- efi_call_phys1(fh->close, files[k].handle);
+ efi_call_phys1(files[k].handle->close, files[k].handle);
free_files:
efi_call_phys1(sys_table_arg->boottime->free_pool, files);
fail: