[usb/usbehci]
authorMichael Martin <michael.martin@reactos.org>
Sun, 10 Jan 2010 11:08:51 +0000 (11:08 +0000)
committerMichael Martin <michael.martin@reactos.org>
Sun, 10 Jan 2010 11:08:51 +0000 (11:08 +0000)
- DeviceArrivalWorkItem: Check the device object returned from IoGetAttachedDeviceReference. if its the PDO, deref and return.
- Pass upper attached device object pointer to the completion routine.
- ArrivalNotificationCompletion: Dereference the upper attached device object before returning.

svn path=/trunk/; revision=45023

reactos/drivers/usb/usbehci/irp.c

index 137e3a2..d099646 100644 (file)
@@ -98,7 +98,9 @@ NTSTATUS
 NTAPI
 ArrivalNotificationCompletion(PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID PContext)
 {
+    PDEVICE_OBJECT PortDeviceObject = (PDEVICE_OBJECT) PContext;
     IoFreeIrp(Irp);
+    ObDereferenceObject(PortDeviceObject);
     return STATUS_MORE_PROCESSING_REQUIRED;
 }
 
@@ -120,6 +122,12 @@ DeviceArrivalWorkItem(PDEVICE_OBJECT DeviceObject, PVOID Context)
         return;
     }
 
+    if (PortDeviceObject == DeviceObject)
+    {
+        /* Piontless to send query relations to ourself */
+        ObDereferenceObject(PortDeviceObject);
+    }
+
     Irp = IoAllocateIrp(PortDeviceObject->StackSize, FALSE);
 
     if (!Irp)
@@ -129,7 +137,7 @@ DeviceArrivalWorkItem(PDEVICE_OBJECT DeviceObject, PVOID Context)
 
     IoSetCompletionRoutine(Irp,
                            (PIO_COMPLETION_ROUTINE)ArrivalNotificationCompletion,
-                           NULL,
+                           (PVOID) PortDeviceObject,
                            TRUE,
                            TRUE,
                            TRUE);