]> git.proxmox.com Git - mirror_edk2.git/commitdiff
EmbeddedPkg/Universal/MmcDxe: "fix" CloseProtocol() call in BindingStop()
authorLaszlo Ersek <lersek@redhat.com>
Fri, 6 Sep 2019 23:43:28 +0000 (01:43 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Wed, 9 Oct 2019 07:40:09 +0000 (09:40 +0200)
The 3rd and 4th parameters of the CloseProtocol() call are wrong.

Given that we're not dissociating a child controller from a parent
controller (= closing a BY_CHILD_CONTROLLER open), but closing a BY_DRIVER
open, the 4th parameter (ControllerHandle) should equal the 1st parameter
(Handle).

It's unclear why this code hasn't crashed before.

Note that the patch doesn't fix the underlying driver model bug. I don't
understand what the loop in MmcDriverBindingStop() attempts to do. Is this
driver supposed to be a bus driver? It seems to create new handles, and to
append device path nodes. But it doesn't set up proper parent/child
protocol opens, and it doesn't close them.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
EmbeddedPkg/Universal/MmcDxe/Mmc.c

index 2f9ec9c7e7c18c94ab80fc8252bf89573c3e067f..c6170880debdd71912755537ba8a8e3597941b41 100644 (file)
@@ -329,8 +329,9 @@ MmcDriverBindingStop (
     // Close gEfiMmcHostProtocolGuid\r
     Status = gBS->CloseProtocol (\r
                 Controller,\r
-                &gEfiMmcHostProtocolGuid,(VOID **) &MmcHostInstance->MmcHost,\r
-                This->DriverBindingHandle\r
+                &gEfiMmcHostProtocolGuid,\r
+                This->DriverBindingHandle,\r
+                Controller\r
                 );\r
 \r
     // Remove MMC Host Instance from the pool\r