From: "Michael Brown" <mcb30@ipxe.org>
To: devel@edk2.groups.io, mjsbeaton@gmail.com
Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>,
Jiaxin Wu <jiaxin.wu@intel.com>, Siyuan Fu <siyuan.fu@intel.com>
Subject: Re: [edk2-devel] [PATCH] NetworkPkg/HttpBootDxe: Correctly uninstall HttpBootCallbackProtocol
Date: Sat, 6 Apr 2024 17:11:11 +0000 [thread overview]
Message-ID: <0102018eb46489d7-9d4baa6c-98e6-4ef5-a477-1beeb1980005-000000@eu-west-1.amazonses.com> (raw)
In-Reply-To: <20240406155312.26851-1-mjsbeaton@gmail.com>
On 06/04/2024 16:53, Mike Beaton wrote:
> The existing uninstall call was passing the wrong handle (parent object,
> not the correct child object) and additionally passing the address
> of a pointer to the interface to be removed rather than the pointer
> itself, so always failed with EFI_NOT_FOUND. After altering these, we
> add an ASSERT which confirms that the modified uninstall is succeeding.
>
> Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
> Cc: Jiaxin Wu <jiaxin.wu@intel.com>
> Cc: Siyuan Fu <siyuan.fu@intel.com>
> Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
> ---
> NetworkPkg/HttpBootDxe/HttpBootImpl.c | 21 ++++++++++++++++-----
> 1 file changed, 16 insertions(+), 5 deletions(-)
>
> diff --git a/NetworkPkg/HttpBootDxe/HttpBootImpl.c b/NetworkPkg/HttpBootDxe/HttpBootImpl.c
> index b4c61925b9..100b721ad4 100644
> --- a/NetworkPkg/HttpBootDxe/HttpBootImpl.c
> +++ b/NetworkPkg/HttpBootDxe/HttpBootImpl.c
> @@ -77,12 +77,23 @@ HttpBootUninstallCallback (
> IN HTTP_BOOT_PRIVATE_DATA *Private
> )
> {
> + EFI_STATUS Status;
> + EFI_HANDLE ControllerHandle;
> +
> if (Private->HttpBootCallback == &Private->LoadFileCallback) {
> - gBS->UninstallProtocolInterface (
> - Private->Controller,
> - &gEfiHttpBootCallbackProtocolGuid,
> - &Private->HttpBootCallback
> - );
> + if (!Private->UsingIpv6) {
> + ControllerHandle = Private->Ip4Nic->Controller;
> + } else {
> + ControllerHandle = Private->Ip6Nic->Controller;
> + }
> +
> + Status = gBS->UninstallProtocolInterface (
> + ControllerHandle,
> + &gEfiHttpBootCallbackProtocolGuid,
> + Private->HttpBootCallback
> + );
> + ASSERT_EFI_ERROR (Status);
This assertion is not necessarily safe. Uninstallation of protocol
interfaces is allowed to fail under the UEFI model. (This is arguably
insane, but that's a separate discussion.) This could therefore
potentially result in a perfectly valid sequence of events leading to an
ASSERT() failure.
Thanks,
Michael
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117469): https://edk2.groups.io/g/devel/message/117469
Mute This Topic: https://groups.io/mt/105368366/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
next prev parent reply other threads:[~2024-04-06 17:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-06 15:53 [edk2-devel] [PATCH] NetworkPkg/HttpBootDxe: Correctly uninstall HttpBootCallbackProtocol Mike Beaton
2024-04-06 17:11 ` Michael Brown [this message]
2024-04-19 10:02 ` Mike Beaton
2024-04-20 16:31 ` Michael Brown
2024-04-21 4:17 ` Mike Beaton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0102018eb46489d7-9d4baa6c-98e6-4ef5-a477-1beeb1980005-000000@eu-west-1.amazonses.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox