]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/ComponentName.c
Fix component name bugs when input Controller Name is invalid
[mirror_edk2.git] / EdkNt32Pkg / Dxe / WinNtThunk / Bus / BlockIo / ComponentName.c
index a24f6da602d5d38650f700dc2ef99c43217ecc04..fb9cc42492019751c417e6e04b4b0b44871cc672 100644 (file)
@@ -160,7 +160,17 @@ WinNtBlockIoComponentNameGetControllerName (
   if (ChildHandle != NULL) {\r
     return EFI_UNSUPPORTED;\r
   }\r
-\r
+  //\r
+  // Make sure this driver is currently managing ControllerHandle\r
+  //\r
+  Status = EfiTestManagedDevice (\r
+             ControllerHandle,\r
+             gWinNtBlockIoDriverBinding.DriverBindingHandle,\r
+             &gEfiWinNtIoProtocolGuid\r
+             );\r
+  if (EFI_ERROR (Status)) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
   //\r
   // Get our context back\r
   //\r