From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: redhat.com, ip: 209.132.183.28, mailfrom: lersek@redhat.com) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by groups.io with SMTP; Mon, 30 Sep 2019 13:16:40 -0700 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 87ADD30BEBF9; Mon, 30 Sep 2019 20:16:39 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-121-111.rdu2.redhat.com [10.10.121.111]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5885560F80; Mon, 30 Sep 2019 20:16:35 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH 19/35] NetworkPkg: fix CloseProtocol & UninstallMultipleProtocolInterfaces calls To: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= , devel@edk2.groups.io Cc: Jiaxin Wu , Siyuan Fu References: <20190917194935.24322-1-lersek@redhat.com> <20190917194935.24322-20-lersek@redhat.com> From: "Laszlo Ersek" Message-ID: <4ba0e969-24a4-a940-8dc8-f1e754995267@redhat.com> Date: Mon, 30 Sep 2019 22:16:34 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 30 Sep 2019 20:16:39 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Hi Phil, On 09/26/19 14:42, Philippe Mathieu-Daud=C3=A9 wrote: > Hi Laszlo, >=20 > On 9/17/19 9:49 PM, Laszlo Ersek wrote: >> Both the "ControllerHandle" parameter of CloseProtocol() >=20 > Maybe worth adding "of type EFI_CLOSE_PROTOCOL" >=20 >> and the "Handle" >> parameter of UninstallMultipleProtocolInterfaces()=20 >=20 > "of type EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES" I don't think these changes would add much information. The above names are -- strictly speaking -- field names in the EFI_BOOT_SERVICES structure. However, in UEFI code, they are so frequently used that people simply refer to them - either by just the member name, - or by the pointer type *in itself*. So using EFI_CLOSE_PROTOCOL in itself would certainly be correct and directly understandable, same as CloseProtocol(). Using both at the same type is redundant. You can observe this simplification in the spec as well, BTW. For example, in UEFI-2.8 "2.5.4 Device Drivers", we find OpenProtocol() and CloseProtocol() update the handle database maintained by the system firmware to track which drivers are consuming protocol interfaces. Another comment below: >=20 > have type EFI_HANDLE, >> not (EFI_HANDLE*). >> >> This patch fixes actual bugs. The issues have been dormant likely beca= use >> they are on error paths. (Or, in case of TlsAuthConfigDxe, because the >> driver is unloaded likely very infrequently.) >> >> Cc: Jiaxin Wu >> Cc: Siyuan Fu >> Signed-off-by: Laszlo Ersek >> --- >> >> Notes: >> build-tested only >> >> NetworkPkg/DnsDxe/DnsDriver.c | 4 ++-- >> NetworkPkg/IScsiDxe/IScsiConfig.c | 2 +- >> NetworkPkg/Ip4Dxe/Ip4Driver.c | 2 +- >> NetworkPkg/Ip6Dxe/Ip6Driver.c | 2 +- >> NetworkPkg/Mtftp4Dxe/Mtftp4Driver.c | 2 +- >> NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.c | 2 +- >> 6 files changed, 7 insertions(+), 7 deletions(-) >> >> diff --git a/NetworkPkg/DnsDxe/DnsDriver.c b/NetworkPkg/DnsDxe/DnsDriv= er.c >> index 94d072159a4d..ad007da8b7d6 100644 >> --- a/NetworkPkg/DnsDxe/DnsDriver.c >> +++ b/NetworkPkg/DnsDxe/DnsDriver.c >> @@ -1145,7 +1145,7 @@ Dns4ServiceBindingCreateChild ( >> DnsSb->ConnectUdp->UdpHandle, >> &gEfiUdp4ProtocolGuid, >> gDns4DriverBinding.DriverBindingHandle, >> - ChildHandle >> + *ChildHandle >=20 > EFI_CLOSE_PROTOCOL, OK. >=20 >> ); >> =20 >> gBS->UninstallMultipleProtocolInterfaces ( >> @@ -1388,7 +1388,7 @@ Dns6ServiceBindingCreateChild ( >> DnsSb->ConnectUdp->UdpHandle, >> &gEfiUdp6ProtocolGuid, >> gDns6DriverBinding.DriverBindingHandle, >> - ChildHandle >> + *ChildHandle >=20 > EFI_CLOSE_PROTOCOL, OK. >=20 >> ); >> =20 >> gBS->UninstallMultipleProtocolInterfaces ( >> diff --git a/NetworkPkg/IScsiDxe/IScsiConfig.c b/NetworkPkg/IScsiDxe/I= ScsiConfig.c >> index b876da7f5ccd..d773849fd3b0 100644 >> --- a/NetworkPkg/IScsiDxe/IScsiConfig.c >> +++ b/NetworkPkg/IScsiDxe/IScsiConfig.c >> @@ -3852,7 +3852,7 @@ IScsiConfigFormInit ( >> ); >> if (CallbackInfo->RegisteredHandle =3D=3D NULL) { >> gBS->UninstallMultipleProtocolInterfaces ( >> - &CallbackInfo->DriverHandle, >> + CallbackInfo->DriverHandle, >=20 > EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES, OK. >=20 >> &gEfiDevicePathProtocolGuid, >> &mIScsiHiiVendorDevicePath, >> &gEfiHiiConfigAccessProtocolGuid, >> diff --git a/NetworkPkg/Ip4Dxe/Ip4Driver.c b/NetworkPkg/Ip4Dxe/Ip4Driv= er.c >> index ebd4dec1dfe4..62be8b681a18 100644 >> --- a/NetworkPkg/Ip4Dxe/Ip4Driver.c >> +++ b/NetworkPkg/Ip4Dxe/Ip4Driver.c >> @@ -891,7 +891,7 @@ Ip4ServiceBindingCreateChild ( >> ); >> if (EFI_ERROR (Status)) { >> gBS->UninstallMultipleProtocolInterfaces ( >> - ChildHandle, >> + *ChildHandle, >=20 > EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES, OK. >=20 >> &gEfiIp4ProtocolGuid, >> &IpInstance->Ip4Proto, >> NULL >> diff --git a/NetworkPkg/Ip6Dxe/Ip6Driver.c b/NetworkPkg/Ip6Dxe/Ip6Driv= er.c >> index 7dc9e45af7b6..63d8428dbced 100644 >> --- a/NetworkPkg/Ip6Dxe/Ip6Driver.c >> +++ b/NetworkPkg/Ip6Dxe/Ip6Driver.c >> @@ -888,7 +888,7 @@ Ip6ServiceBindingCreateChild ( >> ); >> if (EFI_ERROR (Status)) { >> gBS->UninstallMultipleProtocolInterfaces ( >> - ChildHandle, >> + *ChildHandle, >=20 > EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES, OK. >=20 >> &gEfiIp6ProtocolGuid, >> &IpInstance->Ip6Proto, >> NULL >> diff --git a/NetworkPkg/Mtftp4Dxe/Mtftp4Driver.c b/NetworkPkg/Mtftp4Dx= e/Mtftp4Driver.c >> index ae9e65544a86..06c4e202d3ef 100644 >> --- a/NetworkPkg/Mtftp4Dxe/Mtftp4Driver.c >> +++ b/NetworkPkg/Mtftp4Dxe/Mtftp4Driver.c >> @@ -592,7 +592,7 @@ Mtftp4ServiceBindingCreateChild ( >> MtftpSb->ConnectUdp->UdpHandle, >> &gEfiUdp4ProtocolGuid, >> gMtftp4DriverBinding.DriverBindingHandle, >> - ChildHandle >> + *ChildHandle >=20 > EFI_CLOSE_PROTOCOL, OK. >=20 >> ); >> goto ON_ERROR; >> } >> diff --git a/NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.c b/NetworkP= kg/TlsAuthConfigDxe/TlsAuthConfigDxe.c >> index 18ee763002b4..c0870ab9979c 100644 >> --- a/NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.c >> +++ b/NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.c >> @@ -39,7 +39,7 @@ TlsAuthConfigDxeUnload ( >> ASSERT (PrivateData->Signature =3D=3D TLS_AUTH_CONFIG_PRIVATE_DATA_= SIGNATURE); >> =20 >> gBS->UninstallMultipleProtocolInterfaces ( >> - &ImageHandle, >> + ImageHandle, >=20 > EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES, OK. >=20 >> &gEfiCallerIdGuid, >> PrivateData, >> NULL >> >=20 > I'd have split this patch in 2 for easier review (one fixing > EFI_CLOSE_PROTOCOL, another fixing > EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES). >=20 > As it or split: > Reviewed-by: Philippe Mathieu-Daud=C3=A9 Splitting these patches the right way was a difficult question for me. I didn't want to give each fix its own patch (because, presumably, nobody likes a ~100-patch series, with one-liner fixes, except me, I guess... I do like that, after all that's how I fixed the issues, one by one). And once I opted for a coarser granularity, it was hard to tell how much coarser it should get. As you can see, it varies over the series -- sometimes it's Pkg-level, sometimes it's module-level... Unless there's a critical issue, I'd like to stick with the present version. (Managing the feedback tags manually hasn't been trivial!) So I'll take your R-b for the patch as-is, if that's OK with you. Thanks! Laszlo