Skip to content

Commit d39e686

Browse files
committed
NetworkPkg: Handle wait exit on poll failure
`EfiDhcp4Start()` would spin forever if `DhcpSb->IoStatus` is not updated from `EFI_ALREADY_STARTED`. This change captures the poll status (instead of ignoring it) and break out on failures so scenarios like unplug/media-loss return an error instead of hanging. Signed-off-by: Michael Kubacki <[email protected]>
1 parent 860256e commit d39e686

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

NetworkPkg/Dhcp4Dxe/Dhcp4Impl.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,15 @@ EfiDhcp4Start (
824824

825825
if (CompletionEvent == NULL) {
826826
while (DhcpSb->IoStatus == EFI_ALREADY_STARTED) {
827-
DhcpSb->UdpIo->Protocol.Udp4->Poll (DhcpSb->UdpIo->Protocol.Udp4);
827+
// MU_CHANGE [BEGIN] - Add Udp4 Polling break support
828+
Status = DhcpSb->UdpIo->Protocol.Udp4->Poll (DhcpSb->UdpIo->Protocol.Udp4);
829+
if (EFI_ERROR (Status)) {
830+
// Break out if the NIC goes away or poll fails so we don't spin forever.
831+
DhcpSb->IoStatus = Status;
832+
break;
833+
}
834+
835+
// MU_CHANGE [END] - Add Udp4 Polling break support
828836
}
829837

830838
return DhcpSb->IoStatus;

0 commit comments

Comments
 (0)