[NTOS:IO]

- Add missing SEH around user buffer access in IopCompleteRequest
- Remove a redundant condition
CORE-9624

svn path=/trunk/; revision=67485
This commit is contained in:
Thomas Faber 2015-05-01 10:49:50 +00:00
parent fd81042a22
commit 6a200446dc

View file

@ -283,12 +283,20 @@ IopCompleteRequest(IN PKAPC Apc,
if ((Irp->Flags & IRP_INPUT_OPERATION) && if ((Irp->Flags & IRP_INPUT_OPERATION) &&
(Irp->IoStatus.Status != STATUS_VERIFY_REQUIRED) && (Irp->IoStatus.Status != STATUS_VERIFY_REQUIRED) &&
!(NT_ERROR(Irp->IoStatus.Status))) !(NT_ERROR(Irp->IoStatus.Status)))
{
_SEH2_TRY
{ {
/* Copy the buffer back to the user */ /* Copy the buffer back to the user */
RtlCopyMemory(Irp->UserBuffer, RtlCopyMemory(Irp->UserBuffer,
Irp->AssociatedIrp.SystemBuffer, Irp->AssociatedIrp.SystemBuffer,
Irp->IoStatus.Information); Irp->IoStatus.Information);
} }
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
/* Do nothing */
}
_SEH2_END;
}
/* Also check if we should de-allocate it */ /* Also check if we should de-allocate it */
if (Irp->Flags & IRP_DEALLOCATE_BUFFER) if (Irp->Flags & IRP_DEALLOCATE_BUFFER)
@ -317,10 +325,9 @@ IopCompleteRequest(IN PKAPC Apc,
* (but warnings are OK!), or if it was completed with an error, but * (but warnings are OK!), or if it was completed with an error, but
* did return from a pending I/O Operation and is not synchronous. * did return from a pending I/O Operation and is not synchronous.
*/ */
if (!(NT_ERROR(Irp->IoStatus.Status)) || if (!NT_ERROR(Irp->IoStatus.Status) ||
(NT_ERROR(Irp->IoStatus.Status) && (Irp->PendingReturned &&
(Irp->PendingReturned) && !IsIrpSynchronous(Irp, FileObject)))
!(IsIrpSynchronous(Irp, FileObject))))
{ {
/* Get any information we need from the FO before we kill it */ /* Get any information we need from the FO before we kill it */
if ((FileObject) && (FileObject->CompletionContext)) if ((FileObject) && (FileObject->CompletionContext))