From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=Wb6Me4ST; spf=pass (domain: linaro.org, ip: 209.85.128.66, mailfrom: ard.biesheuvel@linaro.org) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by groups.io with SMTP; Wed, 25 Sep 2019 08:53:04 -0700 Received: by mail-wm1-f66.google.com with SMTP id b24so5514769wmj.5 for ; Wed, 25 Sep 2019 08:53:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=E/tovD3q6KezE+rR5dro+SZjHNoO4YlFEG0WstwY2dQ=; b=Wb6Me4STJC+7X8DsFSITCsq8LDP6IF8N681zwdA9nSU6k/FP9PNwwOhZvC1CVJklHV N+SBJlmcIyRQe7/uDHz9pfbBHBt2Dx9n4V9cR/eJWuLxdnfcwLzDbXtapOFiJhUsinRl Ehu9ssYcGkCg8VsBY9hyv6lsNjyCaUoCtHmV8i3TQpaHsySE+FekbgyR4yNynBTo1VoQ wSBicj4gKonH305vFhEBPTG8bVUDBw/N9tNpMrCySYrX001ApChOFsBeSYD+xWbIMQBt qPc4tCITsLImTPYig5dTJojFLa6eR+jwBqyaR9N/PQ0tK3CI51TByAC6B2VySQ0rbKck GIIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=E/tovD3q6KezE+rR5dro+SZjHNoO4YlFEG0WstwY2dQ=; b=sGEpxoBTKGVexTCED33D+q7I45qXJmY8U4aQyFx4vBSDnbpRt4oNRhvIuPqN9EM166 +ZUGuaIenlYIcqL/Xp5d1QHBkVE9Vg/ivWc+kDd+qrRa0FVZWwSXYQKVLQOHo74D/+K3 zmZHDwtnGVHM905896gwhDxn65RRZ3UyXC1K8Zr0PikDOENKquR6//zpKFFGSThsN579 x3Ue5M19qUBPFulEVwaThKPw4C6GMlbxgrJ6kGwEaq10FwnHYA/6r8H4dEid59cEGE/a 6zGnIbioZXa3MFDvpWXdUpdtu/XAKoVdeUfjXvBUiHrFxSjGe+dj2XqVG2lyKiWjUxiy cSxg== X-Gm-Message-State: APjAAAXr+n8zzbGrSggYJNcNqZDRLQ8VanvPpJdCWPVbVJ8zdZqhW0Fo pPJtamJXSS1Q055HYUjeojKuglnGLeF3HRhv7pcofghDuJTLcw== X-Google-Smtp-Source: APXvYqy1AI67It7eywPvC3G0MEuzDNjNAp5uZmNeVP361hWNUwflG1sR7G8qp4VIryxsEIuNvmWEHNpiFuhc9JBhqEk= X-Received: by 2002:a7b:cb55:: with SMTP id v21mr889670wmj.53.1569426782346; Wed, 25 Sep 2019 08:53:02 -0700 (PDT) MIME-Version: 1.0 References: <20190917194935.24322-1-lersek@redhat.com> <20190917194935.24322-5-lersek@redhat.com> In-Reply-To: <20190917194935.24322-5-lersek@redhat.com> From: "Ard Biesheuvel" Date: Wed, 25 Sep 2019 17:52:51 +0200 Message-ID: Subject: Re: [PATCH 04/35] EmbeddedPkg/Universal/MmcDxe: "fix" CloseProtocol() call in BindingStop() To: Laszlo Ersek Cc: edk2-devel-groups-io , Leif Lindholm Content-Type: text/plain; charset="UTF-8" On Tue, 17 Sep 2019 at 21:49, Laszlo Ersek wrote: > > 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 > Cc: Leif Lindholm > Signed-off-by: Laszlo Ersek This code predates my involvement in Tianocore, so I cannot answer your questions. For the change itself, Acked-by: Ard Biesheuvel > --- > > Notes: > build-tested only > > EmbeddedPkg/Universal/MmcDxe/Mmc.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/EmbeddedPkg/Universal/MmcDxe/Mmc.c b/EmbeddedPkg/Universal/MmcDxe/Mmc.c > index 2f9ec9c7e7c1..c6170880debd 100644 > --- a/EmbeddedPkg/Universal/MmcDxe/Mmc.c > +++ b/EmbeddedPkg/Universal/MmcDxe/Mmc.c > @@ -329,8 +329,9 @@ MmcDriverBindingStop ( > // Close gEfiMmcHostProtocolGuid > Status = gBS->CloseProtocol ( > Controller, > - &gEfiMmcHostProtocolGuid,(VOID **) &MmcHostInstance->MmcHost, > - This->DriverBindingHandle > + &gEfiMmcHostProtocolGuid, > + This->DriverBindingHandle, > + Controller > ); > > // Remove MMC Host Instance from the pool > -- > 2.19.1.3.g30247aa5d201 > >