public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH v2] NetworkPkg/HttpBootDxe: Correctly uninstall HttpBootCallbackProtocol
@ 2024-04-06 18:21 Mike Beaton
  2024-04-08 13:51 ` Mike Beaton
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Beaton @ 2024-04-06 18:21 UTC (permalink / raw)
  To: devel; +Cc: Mike Beaton, Michael Brown, Maciej Rabeda, Jiaxin Wu

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.

While it might seem attractive to ASSERT to ensure that the uninstall
proceeds as expected, uninstallation of protocol interfaces is allowed
to fail under the UEFI model. An ASSERT could therefore result in a
sequence of events which is perfectly valid - or at least is out of
the control of this driver - resulting in an ASSERT() failure.

Cc: Michael Brown <mcb30@ipxe.org>
Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>

xyz
---
 NetworkPkg/HttpBootDxe/HttpBootImpl.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootImpl.c b/NetworkPkg/HttpBootDxe/HttpBootImpl.c
index b4c61925b9..f78eef4a83 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootImpl.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootImpl.c
@@ -77,11 +77,19 @@ HttpBootUninstallCallback (
   IN HTTP_BOOT_PRIVATE_DATA  *Private
   )
 {
+  EFI_HANDLE  ControllerHandle;
+
   if (Private->HttpBootCallback == &Private->LoadFileCallback) {
+    if (!Private->UsingIpv6) {
+      ControllerHandle = Private->Ip4Nic->Controller;
+    } else {
+      ControllerHandle = Private->Ip6Nic->Controller;
+    }
+
     gBS->UninstallProtocolInterface (
-           Private->Controller,
+           ControllerHandle,
            &gEfiHttpBootCallbackProtocolGuid,
-           &Private->HttpBootCallback
+           Private->HttpBootCallback
            );
     Private->HttpBootCallback = NULL;
   }
-- 
2.44.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117470): https://edk2.groups.io/g/devel/message/117470
Mute This Topic: https://groups.io/mt/105371091/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [edk2-devel] [PATCH v2] NetworkPkg/HttpBootDxe: Correctly uninstall HttpBootCallbackProtocol
  2024-04-06 18:21 [edk2-devel] [PATCH v2] NetworkPkg/HttpBootDxe: Correctly uninstall HttpBootCallbackProtocol Mike Beaton
@ 2024-04-08 13:51 ` Mike Beaton
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Beaton @ 2024-04-08 13:51 UTC (permalink / raw)
  To: Mike Beaton, devel

[-- Attachment #1: Type: text/plain, Size: 485 bytes --]

Does anybody have any suggestions who I should cc as regards this?

Is it preferred to make a bugtracker issue too?


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117500): https://edk2.groups.io/g/devel/message/117500
Mute This Topic: https://groups.io/mt/105371091/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



[-- Attachment #2: Type: text/html, Size: 905 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-08 13:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-06 18:21 [edk2-devel] [PATCH v2] NetworkPkg/HttpBootDxe: Correctly uninstall HttpBootCallbackProtocol Mike Beaton
2024-04-08 13:51 ` Mike Beaton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox