diff options
author | Michael Brown <mcb30@ipxe.org> | 2020-10-13 19:08:25 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2020-10-13 19:18:41 +0100 |
commit | 02748d0a584f22a568347d719291725e6fd63029 (patch) | |
tree | de4cfbb29ee9dd6b41a99fcd8d48fb878755fcfd | |
parent | 6d680bdec59b103f84ee922ec66ae5219c939938 (diff) | |
download | ipxe-02748d0a584f22a568347d719291725e6fd63029.tar.gz |
[efi] Defer local download process until file has been opened
When iPXE is downloading a file from an EFI_FILE_PROTOCOL instance
backed by an EFI_BLOCK_IO_PROTOCOL instance provided by the same iPXE
binary (e.g. via a hooked SAN device), then it is possible for step()
to be invoked as a result of the calls into the EFI_BLOCK_IO_PROTOCOL
methods. This can potentially result in efi_local_step() being run
prematurely, before the file has been opened and before the parent
interface has been attached.
Fix by deferring starting the download process until immediately prior
to returning from efi_local_open().
Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r-- | src/interface/efi/efi_local.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/interface/efi/efi_local.c b/src/interface/efi/efi_local.c index 79ea822f3..617895650 100644 --- a/src/interface/efi/efi_local.c +++ b/src/interface/efi/efi_local.c @@ -548,8 +548,8 @@ static int efi_local_open ( struct interface *xfer, struct uri *uri ) { } ref_init ( &local->refcnt, NULL ); intf_init ( &local->xfer, &efi_local_xfer_desc, &local->refcnt ); - process_init ( &local->process, &efi_local_process_desc, - &local->refcnt ); + process_init_stopped ( &local->process, &efi_local_process_desc, + &local->refcnt ); /* Open specified volume */ if ( ( rc = efi_local_open_volume ( local, volume ) ) != 0 ) @@ -563,6 +563,9 @@ static int efi_local_open ( struct interface *xfer, struct uri *uri ) { if ( ( rc = efi_local_len ( local ) ) != 0 ) goto err_len; + /* Start download process */ + process_add ( &local->process ); + /* Attach to parent interface, mortalise self, and return */ intf_plug_plug ( &local->xfer, xfer ); ref_put ( &local->refcnt ); |