Is it possible for the system to call a driver’s Unload routine
when there is a queued DPC or when a DPC routine is being executed?
I’m trying to make my driver multi-processor safe, and would like
to safeguard against the following scenario:
The driver is running on two processors. Processor 1 dequeues
a DPC and begins executing the associated DPC routine. At the same
time Processor 2 begins executing a Unload call from the system,
requesting that
all resources be released or that the driver be unloaded. Processor 1
then receives
an external interrupt which interrupts the execution of the DPC routine.
Before releasing the resources, the Unload routine calls KeRemoveQueueDpc
to
ensure that all queued DPCs are kept from starting, then releases all
driver resources.
However, this call apparently does not affect the DPC and its routine
that Processor 1
has already started executing. Processor 1 completes the handling of the
external interrupt,
then resumes executing the DPC routine and attempts to use a resource
that has already
been released by the Unload call. Is there a potential race condition or
blue sceen here?
Thanks for any information and insights.
Chris
YOU’RE PAYING TOO MUCH FOR THE INTERNET!
Juno now offers FREE Internet Access!
Try it today - there’s no risk! For your FREE software, visit:
http://dl.www.juno.com/get/tagj.