[IBAL] Fix race between user-mode PnP deregistration and PnP callbacks.
[mirror/winof/.git] / core / al / kernel / al_pnp.c
index 50854c5..b24745d 100644 (file)
@@ -312,6 +312,14 @@ __pnp_reg_cleanup(
                IoCompleteRequest( p_irp, IO_NO_INCREMENT );\r
        }\r
 \r
+       if( p_reg->p_dereg_irp )\r
+       {\r
+               p_reg->p_dereg_irp->IoStatus.Status = STATUS_SUCCESS;\r
+               p_reg->p_dereg_irp->IoStatus.Information = 0;\r
+               IoCompleteRequest( p_reg->p_dereg_irp, IO_NO_INCREMENT );\r
+               p_reg->p_dereg_irp = NULL;\r
+       }\r
+\r
        /* Dereference the PnP manager. */\r
        deref_al_obj( &gp_pnp->obj );\r
 \r