Does IoFreeIrp() also deallocate the IRP's MDL?

I was reading through the revised (second edition) version of Art Baker’s
book, page 327,
and I came across an interesting statement and I wanted to check with you
guys to see
if this is true of not:

…“IoFreeIrp(), which releases the system buffer or MDL associated with
the IRP and
then deallocates the IRP itself.”

Is the above statement true?

I can’t see anything in the DDK documentation on IoFreeIrp() to indicate
that it will also
deallocate the IRP’s MDL or SystemBuffer


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

That’s because as far as I know, it doesn’t free either Mdl or SystemBuffer.
If you look at the flpydisk driver in the file floppy.c you can see a call
to IoFreeMdl(Irp->MdlAddress) just before a call to IoFreeIrp(Irp). (Line
4731) If IoFreeIrp frees the MDL we are in big trouble as it already got
freed by the call to IoFreeMdl.

I’d go with what the ddk sample drivers do over what is in that book. Note
that if you create your own IRP using IoAllocateIrp, and you use
SystemBuffer, just how would IoFreeIrp know what to do with SystemBuffer
anyhow? Why should it assume that you allocated it explicitly from non-paged
pool and that you wanted it freed now?

-----Original Message-----
From: Nate Bushman [mailto:xxxxx@Legato.com]
Sent: Wednesday, May 16, 2001 11:49 AM
To: NT Developers Interest List
Subject: [ntdev] Does IoFreeIrp() also deallocate the IRP’s MDL?

I was reading through the revised (second edition) version of Art Baker’s
book, page 327, and I came across an interesting statement and I wanted to
check with you guys to see if this is true of not:

…“IoFreeIrp(), which releases the system buffer or MDL associated with
the IRP and
then deallocates the IRP itself.”

Is the above statement true?

I can’t see anything in the DDK documentation on IoFreeIrp() to indicate
that it will also deallocate the IRP’s MDL or SystemBuffer


You are currently subscribed to ntdev as: xxxxx@stratus.com To
unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

I agree on all counts. Thanks Mark.

-----Original Message-----
From: Roddy, Mark [mailto:xxxxx@stratus.com]
Sent: Wednesday, May 16, 2001 10:57 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Does IoFreeIrp() also deallocate the IRP’s MDL?

That’s because as far as I know, it doesn’t free either Mdl or SystemBuffer.
If you look at the flpydisk driver in the file floppy.c you can see a call
to IoFreeMdl(Irp->MdlAddress) just before a call to IoFreeIrp(Irp). (Line
4731) If IoFreeIrp frees the MDL we are in big trouble as it already got
freed by the call to IoFreeMdl.

I’d go with what the ddk sample drivers do over what is in that book. Note
that if you create your own IRP using IoAllocateIrp, and you use
SystemBuffer, just how would IoFreeIrp know what to do with SystemBuffer
anyhow? Why should it assume that you allocated it explicitly from non-paged
pool and that you wanted it freed now?

-----Original Message-----
From: Nate Bushman [mailto:xxxxx@Legato.com]
Sent: Wednesday, May 16, 2001 11:49 AM
To: NT Developers Interest List
Subject: [ntdev] Does IoFreeIrp() also deallocate the IRP’s MDL?

I was reading through the revised (second edition) version of Art Baker’s
book, page 327, and I came across an interesting statement and I wanted to
check with you guys to see if this is true of not:

…“IoFreeIrp(), which releases the system buffer or MDL associated with
the IRP and
then deallocates the IRP itself.”

Is the above statement true?

I can’t see anything in the DDK documentation on IoFreeIrp() to indicate
that it will also deallocate the IRP’s MDL or SystemBuffer


You are currently subscribed to ntdev as: xxxxx@stratus.com To
unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@legato.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com