]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/ComponentName.c
Fix component name bugs when input Controller Name is invalid
[mirror_edk2.git] / EdkNt32Pkg / Dxe / WinNtThunk / Bus / Gop / ComponentName.c
index 9263b3de1ea042e67431f7777d11d3157460058e..8bdf1130a1ecb3e0437b7e70be95010b2e2e76ae 100644 (file)
@@ -162,8 +162,18 @@ WinNtGopComponentNameGetControllerName (
   if (ChildHandle != NULL) {
     return EFI_UNSUPPORTED;
   }
-
-  //
+  //\r
+  // Make sure this driver is currently managing ControllerHandle\r
+  //\r
+  Status = EfiTestManagedDevice (\r
+             ControllerHandle,\r
+             gWinNtGopDriverBinding.DriverBindingHandle,\r
+             &gEfiWinNtIoProtocolGuid\r
+             );\r
+  if (EFI_ERROR (Status)) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+  //\r
   // Get our context back
   //
   Status = gBS->OpenProtocol (