From 72ed9b68547ef864daa3b38fc3870882b337747a Mon Sep 17 00:00:00 2001 From: Michael Martin Date: Sun, 10 Jan 2010 11:08:51 +0000 Subject: [PATCH] [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. svn path=/trunk/; revision=45023 --- reactos/drivers/usb/usbehci/irp.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/reactos/drivers/usb/usbehci/irp.c b/reactos/drivers/usb/usbehci/irp.c index 137e3a2fc73..d099646af84 100644 --- a/reactos/drivers/usb/usbehci/irp.c +++ b/reactos/drivers/usb/usbehci/irp.c @@ -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); -- 2.17.1