From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 54D5C941DA6 for ; Sat, 6 Apr 2024 18:23:10 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=qaA6KobY4yRuG1O4U/0cefk4LEbDqOSYX3FzyUlzbrY=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240206; t=1712427789; v=1; b=1ovRVnjcKrIV7vzKHEhsafhW8jxFQo1TmxK0/gZB8696aJ0DL0zM1Yr8CunnsdpNCp6HpcoT gqhR2ymFeSFkcZMMBWOqe0gjra+ZZaFP9yPh+02YaT4OmDHMcmnxvw0xtg6UXaRVd9z3v/TmblV V3cGeMsh2QdQA0kaE4kO9enarVEuQbTQ2fLzGq9jet0aO+/29xnha87DV5T9Qw2WksXL1APk0Yj jG1bfQbQJt8xETZt1egCbc4m38Aw/2vYeTiqypGu2MD51GkEtqI5ROvCo8tkzxk/5ufAzSQSUnU 85DSj93mAheQYWBONc5oTvwupwZcOGl7XxcwWvp+60EEQ== X-Received: by 127.0.0.2 with SMTP id LsSwYY7687511xb8pZcTtYTe; Sat, 06 Apr 2024 11:23:09 -0700 X-Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) by mx.groups.io with SMTP id smtpd.web10.41818.1712427788197625411 for ; Sat, 06 Apr 2024 11:23:08 -0700 X-Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-343d2b20c4bso1755765f8f.2 for ; Sat, 06 Apr 2024 11:23:07 -0700 (PDT) X-Gm-Message-State: CYXavTNz0uYaLBLqoXAlSgBsx7686176AA= X-Google-Smtp-Source: AGHT+IEFrXpNQ2CI/8EQ8/PgPEb+M42DZJfcPSSrLaWDTc/QgeOmqR8e9pD10uXD2s2Iz0bdpIBTzw== X-Received: by 2002:adf:ea48:0:b0:33e:1e2b:3f76 with SMTP id j8-20020adfea48000000b0033e1e2b3f76mr3495151wrn.61.1712427785966; Sat, 06 Apr 2024 11:23:05 -0700 (PDT) X-Received: from michaels-air.lan ([185.190.95.91]) by smtp.gmail.com with ESMTPSA id di3-20020a0560000ac300b00341c7129e28sm4961359wrb.91.2024.04.06.11.23.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 06 Apr 2024 11:23:05 -0700 (PDT) From: "Mike Beaton" To: devel@edk2.groups.io Cc: Mike Beaton , Michael Brown , Maciej Rabeda , Jiaxin Wu Subject: [edk2-devel] [PATCH v2] NetworkPkg/HttpBootDxe: Correctly uninstall HttpBootCallbackProtocol Date: Sat, 6 Apr 2024 19:21:41 +0100 Message-ID: <20240406182255.55442-1-mjsbeaton@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Sat, 06 Apr 2024 11:23:08 -0700 Resent-From: mjsbeaton@gmail.com Reply-To: devel@edk2.groups.io,mjsbeaton@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=1ovRVnjc; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io 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 Cc: Maciej Rabeda Cc: Jiaxin Wu Signed-off-by: Mike Beaton 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] -=-=-=-=-=-=-=-=-=-=-=-