Author: vmikayelyan
Date: Fri Aug 19 16:30:53 2016
New Revision: 72383
URL:
http://svn.reactos.org/svn/reactos?rev=72383&view=rev
Log:
usb: hub: PDO: Added query-remove and query-cancel-remove handlers
On IRP_MN_QUERY_REMOVE_DEVICE we are freeing interface obtained from
bottom according MSDN we should check interfaces provided to top, but
here we are not checking. All checking will be performed in roothub
driver's IRP_MN_QUERY_REMOVE_DEVICE handler. This will make problems
when buggy driver is loaded on top of us. But we decided to keep source
simpler, because in any case buggy driver will prevent removing of
whole stack.
Modified:
branches/GSoC_2016/USB/drivers/usb/usbhub/pdo.c
Modified: branches/GSoC_2016/USB/drivers/usb/usbhub/pdo.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/USB/drivers/usb/usbhu…
==============================================================================
--- branches/GSoC_2016/USB/drivers/usb/usbhub/pdo.c [iso-8859-1] (original)
+++ branches/GSoC_2016/USB/drivers/usb/usbhub/pdo.c [iso-8859-1] Fri Aug 19 16:30:53 2016
@@ -745,14 +745,34 @@
}
case IRP_MN_QUERY_REMOVE_DEVICE:
{
- // HERE SHOULD BE CHECKED INTERFACE COUNT PROVIED TO UPPER LAYER TO BE ZERO,
AS WE ARE HANDLING
- // IRP_MN_QUERY_INTERFACE IN WRONG WAY, THAT WILL BE DONE LATER. SEE MSDN
"IRP_MN_QUERY_INTERFACE"
+ //
+ // Free interface obtained from bottom, according MSDN we should
+ // check interfaces provided to top, but here we are not checking.
+ // All checking will be performed in roothub driver's
+ // IRP_MN_QUERY_REMOVE_DEVICE handler. This will make problems when
+ // buggy driver is loaded on top of us. But we decided to keep source
+ // simpler, because in any case buggy driver will prevent removing of
+ // whole stack.
+ //
+
UsbChildExtension->DeviceInterface.InterfaceDereference(UsbChildExtension->DeviceInterface.BusContext);
UsbChildExtension->IsRemovePending = TRUE;
/* Sure, no problem */
Status = STATUS_SUCCESS;
Information = 0;
+ break;
+ }
+ case IRP_MN_CANCEL_REMOVE_DEVICE:
+ {
+ // Check to see have we received query-remove before
+ if (UsbChildExtension->IsRemovePending == TRUE)
+ {
+ UsbChildExtension->IsRemovePending = FALSE;
+
UsbChildExtension->DeviceInterface.InterfaceReference(UsbChildExtension->DeviceInterface.BusContext);
+ }
+
+ Status = STATUS_SUCCESS;
break;
}
case IRP_MN_QUERY_INTERFACE: