Author: janderwald
Date: Mon Jan 23 02:49:40 2012
New Revision: 55088
URL:
http://svn.reactos.org/svn/reactos?rev=55088&view=rev
Log:
[USBSTOR]
- Fix bug in usbstor, which did not take the offset into account
Modified:
branches/usb-bringup-trunk/drivers/usb/usbstor/scsi.c
Modified: branches/usb-bringup-trunk/drivers/usb/usbstor/scsi.c
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
==============================================================================
--- branches/usb-bringup-trunk/drivers/usb/usbstor/scsi.c [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/drivers/usb/usbstor/scsi.c [iso-8859-1] Mon Jan 23 02:49:40
2012
@@ -576,7 +576,7 @@
if (Context->TransferDataLength)
{
//
- // check if the original request already does not have an mdl associated
+ // check if the original request already does have an mdl associated
//
if (OriginalRequest)
{
@@ -589,7 +589,25 @@
if (CommandLength == UFI_READ_WRITE_CMD_LEN)
{
MdlVirtualAddress =
MmGetMdlVirtualAddress(OriginalRequest->MdlAddress);
- ASSERT(MdlVirtualAddress == Context->TransferData);
+ if (MdlVirtualAddress != Context->TransferData)
+ {
+ //
+ // lets build an mdl
+ //
+ Context->TransferBufferMDL = IoAllocateMdl(Context->TransferData,
MmGetMdlByteCount(OriginalRequest->MdlAddress), FALSE, FALSE, NULL);
+ if (!Context->TransferBufferMDL)
+ {
+ //
+ // failed to allocate MDL
+ //
+ return STATUS_INSUFFICIENT_RESOURCES;
+ }
+
+ //
+ // now build the partial mdl
+ //
+ IoBuildPartialMdl(OriginalRequest->MdlAddress, Context->TransferBufferMDL,
Context->TransferData, Context->TransferDataLength);
+ }
}
//