[IBAL] Fix race between user-mode PnP deregistration and PnP callbacks.
authorftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Fri, 31 Mar 2006 22:05:19 +0000 (22:05 +0000)
committerftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Fri, 31 Mar 2006 22:05:19 +0000 (22:05 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@267 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

core/al/al_pnp.h
core/al/kernel/al_pnp.c
core/al/kernel/al_proxy.c

index d77b85a..5b788ab 100644 (file)
@@ -56,6 +56,7 @@ typedef struct _al_pnp
        ib_pnp_class_t                  pnp_class;\r
        cl_qmap_t                               context_map;\r
        IRP                                             *p_rearm_irp;\r
+       IRP                                             *p_dereg_irp;\r
 #else  /* defined( CL_KERNEL ) */\r
        ual_rearm_pnp_ioctl_out_t       rearm;\r
        OVERLAPPED                                      ov;\r
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
index 9e7b464..7a9c9c8 100644 (file)
@@ -1176,24 +1176,6 @@ proxy_rearm_pnp(
 }\r
 \r
 \r
-static void\r
-__proxy_dereg_pnp_cb(\r
-       IN                              void                                            *context )\r
-{\r
-       IRP                             *p_irp;\r
-\r
-       AL_ENTER( AL_DBG_DEV | AL_DBG_PNP );\r
-\r
-       p_irp = context;\r
-\r
-       p_irp->IoStatus.Status = STATUS_SUCCESS;\r
-       p_irp->IoStatus.Information = 0;\r
-       IoCompleteRequest( p_irp, IO_NO_INCREMENT );\r
-\r
-       AL_EXIT( AL_DBG_DEV | AL_DBG_PNP );\r
-}\r
-\r
-\r
 /*\r
  * Process the ioctl UAL_DEREG_PNP:\r
  */\r
@@ -1236,11 +1218,11 @@ proxy_dereg_pnp(
                return CL_INVALID_PARAMETER;\r
        }\r
 \r
-       h_pnp->obj.context = h_ioctl;\r
+       h_pnp->p_dereg_irp = h_ioctl;\r
 \r
        IoMarkIrpPending( h_ioctl );\r
 \r
-       h_pnp->obj.pfn_destroy( &h_pnp->obj, __proxy_dereg_pnp_cb );\r
+       h_pnp->obj.pfn_destroy( &h_pnp->obj, NULL );\r
 \r
        AL_EXIT( AL_DBG_DEV | AL_DBG_PNP );\r
        return CL_PENDING;\r