Author: tfaber
Date: Sat Apr 9 16:13:37 2016
New Revision: 71128
URL:
http://svn.reactos.org/svn/reactos?rev=71128&view=rev
Log:
[USBSTOR]
- In USBSTOR_GetMaxLUN, correctly handle devices that do not support this request. Patch
by Vadim Galyant.
CORE-10515 #resolve
Modified:
trunk/reactos/drivers/usb/usbstor/misc.c
Modified: trunk/reactos/drivers/usb/usbstor/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbstor/misc.c…
==============================================================================
--- trunk/reactos/drivers/usb/usbstor/misc.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbstor/misc.c [iso-8859-1] Sat Apr 9 16:13:37 2016
@@ -23,7 +23,7 @@
NTAPI
USBSTOR_SyncForwardIrpCompletionRoutine(
PDEVICE_OBJECT DeviceObject,
- PIRP Irp,
+ PIRP Irp,
PVOID Context)
{
if (Irp->PendingReturned)
@@ -362,19 +362,34 @@
DPRINT("MaxLUN: %x\n", *Buffer);
- if (*Buffer > 0xF)
- {
- //
- // invalid response documented in usb mass storage specification
- //
- Status = STATUS_DEVICE_DATA_ERROR;
+ if (NT_SUCCESS(Status))
+ {
+ if (*Buffer > 0xF)
+ {
+ //
+ // invalid response documented in usb mass storage specification
+ //
+ Status = STATUS_DEVICE_DATA_ERROR;
+ }
+ else
+ {
+ //
+ // store maxlun
+ //
+ DeviceExtension->MaxLUN = *Buffer;
+ }
}
else
{
//
- // store maxlun
- //
- DeviceExtension->MaxLUN = *Buffer;
+ // "USB Mass Storage Class. Bulk-Only Transport. Revision 1.0"
+ // 3.2 Get Max LUN (class-specific request) :
+ // Devices that do not support multiple LUNs may STALL this command.
+ //
+ USBSTOR_ResetDevice(DeviceExtension->LowerDeviceObject, DeviceExtension);
+
+ DeviceExtension->MaxLUN = 0;
+ Status = STATUS_SUCCESS;
}
//