Fixed the unlocking of pages from a mdl.

svn path=/trunk/; revision=15131
This commit is contained in:
Hartmut Birr 2005-05-08 16:02:38 +00:00
parent 5fd03c29e4
commit 647ee2a30d

View file

@ -61,7 +61,7 @@ IopCompleteRequest(PKAPC Apc,
{ {
PFILE_OBJECT FileObject; PFILE_OBJECT FileObject;
PIRP Irp; PIRP Irp;
PMDL Mdl, NextMdl; PMDL Mdl;
PKEVENT UserEvent; PKEVENT UserEvent;
BOOLEAN SyncIrp; BOOLEAN SyncIrp;
@ -101,17 +101,12 @@ IopCompleteRequest(PKAPC Apc,
Irp->Flags &= ~(IRP_BUFFERED_IO | IRP_DEALLOCATE_BUFFER); Irp->Flags &= ~(IRP_BUFFERED_IO | IRP_DEALLOCATE_BUFFER);
/* Check if there's an MDL */ /* Check if there's an MDL */
if ((Mdl = Irp->MdlAddress)) while ((Mdl = Irp->MdlAddress))
{ {
/* Clear all of them */ /* Clear all of them */
do Irp->MdlAddress = Mdl->Next;
{ IoFreeMdl(Mdl);
NextMdl = Mdl->Next;
IoFreeMdl(Mdl);
Mdl = NextMdl;
} while (Mdl);
} }
Irp->MdlAddress = NULL;
/* Remove the IRP from the list of Thread Pending IRPs */ /* Remove the IRP from the list of Thread Pending IRPs */
RemoveEntryList(&Irp->ThreadListEntry); RemoveEntryList(&Irp->ThreadListEntry);
@ -1122,11 +1117,12 @@ IofCompleteRequest(PIRP Irp,
} }
/* Unlock MDL Pages, page 167. */ /* Unlock MDL Pages, page 167. */
while ((Mdl = Irp->MdlAddress)) Mdl = Irp->MdlAddress;
while (Mdl)
{ {
DPRINT("Unlocking MDL: %x\n", Mdl); DPRINT("Unlocking MDL: %x\n", Mdl);
Irp->MdlAddress = Mdl->Next;
MmUnlockPages(Mdl); MmUnlockPages(Mdl);
Mdl = Mdl->Next;
} }
/* Check if we should exit because of a Deferred I/O (page 168) */ /* Check if we should exit because of a Deferred I/O (page 168) */