Skip to content

Commit

Permalink
ensure APC object is allocated before referencing it
Browse files Browse the repository at this point in the history
  • Loading branch information
richinseattle committed Jun 25, 2017
1 parent 8491e99 commit 66667b0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions WindowsPtDriver/IntelPt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1224,9 +1224,11 @@ VOID IntelPmiDpc(struct _KDPC *pDpc, PVOID DeferredContext, PVOID SystemArgument
continue;
}
pkApc = (PRKAPC)ExAllocatePoolWithTag(NonPagedPool, sizeof(KAPC), MEMTAG);
KeInitializeApc(pkApc, (PRKTHREAD)pCurPmiDesc->pTargetThread, CurrentApcEnvironment, &ApcKernelRoutine, NULL,
(PKNORMAL_ROUTINE)pCurPmiDesc->lpUserAddress, UserMode, (PVOID)dwCpuNum);
KeInsertQueueApc(pkApc, (LPVOID)curCpuData.lpUserVa, (LPVOID)curCpuData.pPtBuffDesc->qwBuffSize, IO_NO_INCREMENT);
if (pkApc) {
KeInitializeApc(pkApc, (PRKTHREAD)pCurPmiDesc->pTargetThread, CurrentApcEnvironment, &ApcKernelRoutine, NULL,
(PKNORMAL_ROUTINE)pCurPmiDesc->lpUserAddress, UserMode, (PVOID)dwCpuNum);
KeInsertQueueApc(pkApc, (LPVOID)curCpuData.lpUserVa, (LPVOID)curCpuData.pPtBuffDesc->qwBuffSize, IO_NO_INCREMENT);
}
}
pNextEntry = pCurEntry->Flink;
}
Expand Down

0 comments on commit 66667b0

Please sign in to comment.