Tech Support > Microsoft Windows > Drivers > Close/DeviceIoControl race conditions
Close/DeviceIoControl race conditions
Posted by v_mirgorodsky@yahoo.com on June 3rd, 2005


Dear ALL!

Is it possible in driver to have a race conditions in IRP_MJ_CLOSE and
IRP_MJ_DEVICE_CONTROL handlers? My system experiences very rare crashes
during my device activity, but never pin-points to my driver as a crash
source. Because of this I think that my driver corrupts some bystander
memory and it crashes the system in turn. The code analysis shows
possible problem if there is a race conditions between mentioned above
handlers.

With best regards,
Vladimir S. Mirgorodsky

Posted by Alexander Grigoriev on June 4th, 2005


It's possible if you release your FILE_OBJECT-specific data in
IRP_MJ_CLEANUP, which is too early.
User-mode issued DEVICE_CONTROL can never race with CLOSE, because CLOSE is
only issued when a last reference to the FILE_OBJECT is released. Each
READ/WRITE/DEVICE_CONTROL IRP takes a reference to FILE_OBJECT.

The problems are also possible if your driver issues its own IRPs, but fails
to cancel them during CLEANUP _and_ CLOSE.

<v_mirgorodsky@yahoo.com> wrote in message
news:1117817948.684983.193750@z14g2000cwz.googlegr oups.com...


Posted by v_mirgorodsky@yahoo.com on June 6th, 2005


Hello Alexander,

Thanks for your responce. Unfortunatelly, it is not my case. I have an
clean-up handler, but it does almost nothing and does not free any
driver resources. Ok, will look further.

With best regards,
Vladimir S. Mirgorodsky


Similar Posts