Fix QuicTraceRundown Race Condition (#2915)

This commit is contained in:
Nick Banks 2022-07-27 13:23:55 -05:00 коммит произвёл GitHub
Родитель 6583df53c0
Коммит d50ee4b831
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 12 добавлений и 6 удалений

Просмотреть файл

@ -65,6 +65,7 @@ MsQuicConnectionOpen(
QuicConnAlloc(
Registration,
NULL,
NULL,
&Connection);
if (QUIC_FAILED(Status)) {
goto Error;
@ -73,8 +74,6 @@ MsQuicConnectionOpen(
Connection->ClientCallbackHandler = Handler;
Connection->ClientContext = Context;
QuicRegistrationQueueNewConnection(Registration, Connection);
*NewConnection = (HQUIC)Connection;
Status = QUIC_STATUS_SUCCESS;

Просмотреть файл

@ -1289,6 +1289,7 @@ QuicBindingCreateConnection(
QUIC_STATUS Status =
QuicConnAlloc(
MsQuicLib.StatelessRegistration,
Worker,
Datagram,
&NewConnection);
if (QUIC_FAILED(Status)) {
@ -1296,8 +1297,6 @@ QuicBindingCreateConnection(
return NULL;
}
QuicWorkerAssignConnection(Worker, NewConnection);
BOOLEAN BindingRefAdded = FALSE;
CXPLAT_DBG_ASSERT(NewConnection->SourceCids.Next != NULL);
QUIC_CID_HASH_ENTRY* SourceCid =

Просмотреть файл

@ -57,6 +57,7 @@ _Success_(return == QUIC_STATUS_SUCCESS)
QUIC_STATUS
QuicConnAlloc(
_In_ QUIC_REGISTRATION* Registration,
_In_opt_ QUIC_WORKER* Worker,
_In_opt_ const CXPLAT_RECV_DATA* const Datagram,
_Outptr_ _At_(*NewConnection, __drv_allocatesMem(Mem))
QUIC_CONNECTION** NewConnection
@ -262,6 +263,9 @@ QuicConnAlloc(
}
QuicPathValidate(Path);
if (Worker != NULL) {
QuicWorkerAssignConnection(Worker, Connection);
}
if (!QuicConnRegister(Connection, Registration)) {
Status = QUIC_STATUS_INVALID_STATE;
goto Error;
@ -572,6 +576,9 @@ QuicConnRegister(
CxPlatDispatchLockAcquire(&Registration->ConnectionLock);
RegistrationShuttingDown = Registration->ShuttingDown;
if (!RegistrationShuttingDown) {
if (Connection->Worker == NULL) {
QuicRegistrationQueueNewConnection(Registration, Connection);
}
CxPlatListInsertTail(&Registration->Connections, &Connection->RegistrationLink);
}
CxPlatDispatchLockRelease(&Registration->ConnectionLock);

Просмотреть файл

@ -957,6 +957,7 @@ _Success_(return == QUIC_STATUS_SUCCESS)
QUIC_STATUS
QuicConnAlloc(
_In_ QUIC_REGISTRATION* Registration,
_In_opt_ QUIC_WORKER* Worker,
_In_opt_ const CXPLAT_RECV_DATA* const Datagram,
_Outptr_ _At_(*NewConnection, __drv_allocatesMem(Mem))
QUIC_CONNECTION** NewConnection

Просмотреть файл

@ -381,7 +381,7 @@ QuicRegistrationSettingsChanged(
CxPlatLockRelease(&Registration->ConfigLock);
}
_IRQL_requires_max_(PASSIVE_LEVEL)
_IRQL_requires_max_(DISPATCH_LEVEL)
BOOLEAN
QuicRegistrationAcceptConnection(
_In_ QUIC_REGISTRATION* Registration,

Просмотреть файл

@ -136,7 +136,7 @@ QuicRegistrationSettingsChanged(
// Determines whether this new connection can be accepted by the registration
// or not.
//
_IRQL_requires_max_(PASSIVE_LEVEL)
_IRQL_requires_max_(DISPATCH_LEVEL)
BOOLEAN
QuicRegistrationAcceptConnection(
_In_ QUIC_REGISTRATION* Registration,