NetworkPkg: Ip4Dxe/Ip6Dxe: Set SB notify to NULL after event close

Ip4StartAutoConfig() and Ip6ConfigStartStatefulAutoConfig() close the
DHCP service binding notify event when the service child is
successfully created, but do not NULL the instance field afterward.

On re-entry, the stale handle passes the non-NULL condition and is
closed a second time, which results in a page fault with memory
protections enabled.

This change sets the event field to NULL immediately after
CloseEvent() so that subsequent calls skip attempting to close the
event again.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
This commit is contained in:
Michael Kubacki 2026-02-27 15:30:52 -05:00 committed by mergify[bot]
parent 6e39689c65
commit e1103f7dca
2 changed files with 2 additions and 0 deletions

View file

@ -935,6 +935,7 @@ Ip4StartAutoConfig (
if (Instance->Dhcp4SbNotifyEvent != NULL) {
gBS->CloseEvent (Instance->Dhcp4SbNotifyEvent);
Instance->Dhcp4SbNotifyEvent = NULL;
}
Status = gBS->OpenProtocol (

View file

@ -227,6 +227,7 @@ Ip6ConfigStartStatefulAutoConfig (
if (Instance->Dhcp6SbNotifyEvent != NULL) {
gBS->CloseEvent (Instance->Dhcp6SbNotifyEvent);
Instance->Dhcp6SbNotifyEvent = NULL;
}
Status = gBS->OpenProtocol (