[ros-diffs] [mjmartin] 45023: [usb/usbehci] - 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.

mjmartin at svn.reactos.org mjmartin at svn.reactos.org
Sun Jan 10 12:08:51 CET 2010


Author: mjmartin
Date: Sun Jan 10 12:08:51 2010
New Revision: 45023

URL: http://svn.reactos.org/svn/reactos?rev=45023&view=rev
Log:
[usb/usbehci]
- 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.

Modified:
    trunk/reactos/drivers/usb/usbehci/irp.c

Modified: trunk/reactos/drivers/usb/usbehci/irp.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/irp.c?rev=45023&r1=45022&r2=45023&view=diff
==============================================================================
--- trunk/reactos/drivers/usb/usbehci/irp.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbehci/irp.c [iso-8859-1] Sun Jan 10 12:08:51 2010
@@ -98,7 +98,9 @@
 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 @@
         return;
     }
 
+    if (PortDeviceObject == DeviceObject)
+    {
+        /* Piontless to send query relations to ourself */
+        ObDereferenceObject(PortDeviceObject);
+    }
+
     Irp = IoAllocateIrp(PortDeviceObject->StackSize, FALSE);
 
     if (!Irp)
@@ -129,7 +137,7 @@
 
     IoSetCompletionRoutine(Irp,
                            (PIO_COMPLETION_ROUTINE)ArrivalNotificationCompletion,
-                           NULL,
+                           (PVOID) PortDeviceObject,
                            TRUE,
                            TRUE,
                            TRUE);




More information about the Ros-diffs mailing list