mirror of
https://github.com/reactos/reactos.git
synced 2024-09-30 22:47:28 +00:00
[TCPIP]
- Fix a crash when a NIC driver indicates the media state before we're expecting it - Fixes bug 6895 svn path=/trunk/; revision=56331
This commit is contained in:
parent
be57977549
commit
4c6cc26667
|
@ -811,6 +811,10 @@ VOID NTAPI ProtocolStatus(
|
|||
|
||||
TI_DbgPrint(DEBUG_DATALINK, ("Called.\n"));
|
||||
|
||||
/* Ignore the status indication if we have no context yet. We'll get another later */
|
||||
if (!Adapter->Context)
|
||||
return;
|
||||
|
||||
Context = ExAllocatePool(NonPagedPool, sizeof(RECONFIGURE_CONTEXT));
|
||||
if (!Context)
|
||||
return;
|
||||
|
@ -1302,6 +1306,7 @@ BOOLEAN BindAdapter(
|
|||
LLIP_BIND_INFO BindInfo;
|
||||
ULONG Lookahead = LOOKAHEAD_SIZE;
|
||||
NTSTATUS Status;
|
||||
NDIS_MEDIA_STATE MediaState;
|
||||
|
||||
TI_DbgPrint(DEBUG_DATALINK, ("Called.\n"));
|
||||
|
||||
|
@ -1388,9 +1393,27 @@ BOOLEAN BindAdapter(
|
|||
/* Register interface with IP layer */
|
||||
IPRegisterInterface(IF);
|
||||
|
||||
/* Set adapter state */
|
||||
/* Store adapter context */
|
||||
Adapter->Context = IF;
|
||||
|
||||
/* Get the media state */
|
||||
NdisStatus = NDISCall(Adapter,
|
||||
NdisRequestQueryInformation,
|
||||
OID_GEN_MEDIA_CONNECT_STATUS,
|
||||
&MediaState,
|
||||
sizeof(MediaState));
|
||||
if (NdisStatus != NDIS_STATUS_SUCCESS) {
|
||||
TI_DbgPrint(DEBUG_DATALINK, ("Could not query media status (0x%X).\n", NdisStatus));
|
||||
IPUnregisterInterface(IF);
|
||||
IPDestroyInterface(IF);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Indicate the current media state */
|
||||
ProtocolStatus(Adapter,
|
||||
(MediaState == NdisMediaStateConnected) ? NDIS_STATUS_MEDIA_CONNECT : NDIS_STATUS_MEDIA_DISCONNECT,
|
||||
NULL, 0);
|
||||
|
||||
/* Set packet filter so we can send and receive packets */
|
||||
NdisStatus = NDISCall(Adapter,
|
||||
NdisRequestSetInformation,
|
||||
|
@ -1405,9 +1428,6 @@ BOOLEAN BindAdapter(
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/* Indicate media connect (our drivers are broken and don't do this) */
|
||||
ProtocolStatus(Adapter, NDIS_STATUS_MEDIA_CONNECT, NULL, 0);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue