Author: tfaber
Date: Sat Oct 29 20:30:49 2016
New Revision: 73072
URL:
http://svn.reactos.org/svn/reactos?rev=73072&view=rev
Log:
[FASTFAT]
- Only lock down the user buffer in the non-cached read/write case. CcCopyRead/CcCopyWrite
takes care of this in the cached case, and does not impose a size limit like an MDL does.
CORE-12132 #resolve
Modified:
trunk/reactos/drivers/filesystems/fastfat/rw.c
Modified: trunk/reactos/drivers/filesystems/fastfat/rw.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat/rw.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat/rw.c [iso-8859-1] Sat Oct 29 20:30:49 2016
@@ -656,11 +656,6 @@
}
Buffer = VfatGetUserBuffer(IrpContext->Irp,
BooleanFlagOn(IrpContext->Irp->Flags, IRP_PAGING_IO));
- Status = VfatLockUserBuffer(IrpContext->Irp, Length, IoWriteAccess);
- if (!NT_SUCCESS(Status))
- {
- goto ByeBye;
- }
if (!(IrpContext->Irp->Flags & (IRP_NOCACHE|IRP_PAGING_IO)) &&
!(Fcb->Flags & (FCB_IS_PAGE_FILE|FCB_IS_VOLUME)))
@@ -711,6 +706,12 @@
else
{
// non cached read
+ Status = VfatLockUserBuffer(IrpContext->Irp, Length, IoWriteAccess);
+ if (!NT_SUCCESS(Status))
+ {
+ goto ByeBye;
+ }
+
if (ByteOffset.QuadPart + Length > ROUND_UP_64(Fcb->RFCB.FileSize.QuadPart,
BytesPerSector))
{
Length = (ULONG)(ROUND_UP_64(Fcb->RFCB.FileSize.QuadPart, BytesPerSector)
- ByteOffset.QuadPart);
@@ -921,12 +922,6 @@
}
Buffer = VfatGetUserBuffer(IrpContext->Irp,
BooleanFlagOn(IrpContext->Irp->Flags, IRP_PAGING_IO));
- Status = VfatLockUserBuffer(IrpContext->Irp, Length, IoReadAccess);
- if (!NT_SUCCESS(Status))
- {
- Status = STATUS_INVALID_USER_BUFFER;
- goto ByeBye;
- }
if (!(Fcb->Flags & (FCB_IS_FAT|FCB_IS_VOLUME)) &&
!(IrpContext->Irp->Flags & IRP_PAGING_IO) &&
@@ -987,6 +982,12 @@
else
{
// non cached write
+ Status = VfatLockUserBuffer(IrpContext->Irp, Length, IoReadAccess);
+ if (!NT_SUCCESS(Status))
+ {
+ Status = STATUS_INVALID_USER_BUFFER;
+ goto ByeBye;
+ }
if (ByteOffset.QuadPart > OldFileSize.QuadPart)
{