summaryrefslogtreecommitdiffstats
path: root/src/interface/efi/efi_driver.c
diff options
context:
space:
mode:
authorMichael Brown2015-09-28 03:54:53 +0200
committerMichael Brown2015-09-28 04:20:59 +0200
commit9ff6d08bf53679f9b513501a5dcf8816cb79deb2 (patch)
tree6bd84ab863e0cea3fed4dd265fc8f04495d7ec2a /src/interface/efi/efi_driver.c
parent[efi] Work around broken 32-bit PE executable parsing in ImageHlp.dll (diff)
downloadipxe-9ff6d08bf53679f9b513501a5dcf8816cb79deb2.tar.gz
ipxe-9ff6d08bf53679f9b513501a5dcf8816cb79deb2.tar.xz
ipxe-9ff6d08bf53679f9b513501a5dcf8816cb79deb2.zip
[efi] Avoid infinite loops when asked to stop non-existent devices
Calling EDK2's OpenProtocol() with attributes BY_DRIVER|EXCLUSIVE will call DisconnectController() in a loop to attempt to dislodge any existing openers with attributes BY_DRIVER. The loop will continue indefinitely until either no such openers remain, or until DisconnectController() returns an error. If our driver binding protocol's Stop() method is ever called to disconnect a device that we are not in fact driving, then return EFI_DEVICE_ERROR rather than EFI_SUCCESS, in order to break this potentially infinite loop. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/interface/efi/efi_driver.c')
-rw-r--r--src/interface/efi/efi_driver.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/interface/efi/efi_driver.c b/src/interface/efi/efi_driver.c
index ec67bbcd..22aa3ee7 100644
--- a/src/interface/efi/efi_driver.c
+++ b/src/interface/efi/efi_driver.c
@@ -254,7 +254,7 @@ efi_driver_stop ( EFI_DRIVER_BINDING_PROTOCOL *driver __unused,
if ( ! efidev ) {
DBGCP ( device, "EFIDRV %s is not started\n",
efi_handle_name ( device ) );
- return 0;
+ return EFI_DEVICE_ERROR;
}
/* Stop this device */