Cancel-safe queue startio sample question

I don’t understand why the following from the startio CSQ sample is not
a race:

VOID CsampInitiateIo(IN PDEVICE_OBJECT DeviceObject)
{
// note no locks grabbed here
irp = devExtension->CurrentIrp;
//…
}

This seems to me that two threads, the queuing thread from CsampRead()
and the Dpc thread started from a timer, could both complete devExtension-

CurrentIrp.

Seems like the read of devExtension->CurrentIrp needs to be protected
with the same lock as CsampInsertIrp() (architecturally messy, as it’s
not a CSQ callback), or else use an interlocked exchange with 0 when
reading it.

Am I missing something?

Joe Black

Concerned about your privacy? Follow this link to get
FREE encrypted email: https://www.hushmail.com/?l=2

Free, ultra-private instant messaging with Hush Messenger
https://www.hushmail.com/services.php?subloc=messenger&l=434

Promote security and make money with the Hushmail Affiliate Program:
https://www.hushmail.com/about.php?subloc=affiliate&l=427