瀏覽代碼

[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>
tags/v1.20.1
Michael Brown 9 年之前
父節點
當前提交
9ff6d08bf5
共有 1 個檔案被更改,包括 1 行新增1 行删除
  1. 1
    1
      src/interface/efi/efi_driver.c

+ 1
- 1
src/interface/efi/efi_driver.c 查看文件

@@ -254,7 +254,7 @@ efi_driver_stop ( EFI_DRIVER_BINDING_PROTOCOL *driver __unused,
254 254
 	if ( ! efidev ) {
255 255
 		DBGCP ( device, "EFIDRV %s is not started\n",
256 256
 			efi_handle_name ( device ) );
257
-		return 0;
257
+		return EFI_DEVICE_ERROR;
258 258
 	}
259 259
 
260 260
 	/* Stop this device */

Loading…
取消
儲存