From: Thomas Faber Date: Sat, 9 Apr 2016 16:13:37 +0000 (+0000) Subject: [USBSTOR] X-Git-Tag: ReactOS-0.4.1~96 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=372ab04bc46f3a6219be95548e6e8b9d8003c5f6;hp=ce2ec6562e45ab7582552b5ac0a9f1eae8ea3ce1;ds=sidebyside [USBSTOR] - In USBSTOR_GetMaxLUN, correctly handle devices that do not support this request. Patch by Vadim Galyant. CORE-10515 #resolve svn path=/trunk/; revision=71128 --- diff --git a/reactos/drivers/usb/usbstor/misc.c b/reactos/drivers/usb/usbstor/misc.c index f78b91c1f22..6b60cf828e7 100644 --- a/reactos/drivers/usb/usbstor/misc.c +++ b/reactos/drivers/usb/usbstor/misc.c @@ -23,7 +23,7 @@ NTSTATUS NTAPI USBSTOR_SyncForwardIrpCompletionRoutine( PDEVICE_OBJECT DeviceObject, - PIRP Irp, + PIRP Irp, PVOID Context) { if (Irp->PendingReturned) @@ -362,19 +362,34 @@ USBSTOR_GetMaxLUN( DPRINT("MaxLUN: %x\n", *Buffer); - if (*Buffer > 0xF) + if (NT_SUCCESS(Status)) { - // - // invalid response documented in usb mass storage specification - // - Status = STATUS_DEVICE_DATA_ERROR; + 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 + // "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. // - DeviceExtension->MaxLUN = *Buffer; + USBSTOR_ResetDevice(DeviceExtension->LowerDeviceObject, DeviceExtension); + + DeviceExtension->MaxLUN = 0; + Status = STATUS_SUCCESS; } //