[FASTFAT] When extending a file, also lock the DirResource.

This avoids race conditions under high IOs and thus corruption on
the FS, or assertions failures in the kernel.
Easily triggered by building ReactOS on ReactOS ;-).
This commit is contained in:
Pierre Schweitzer 2018-05-21 10:28:44 +02:00
parent 0fbaea843e
commit 30b836bf3f
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B

View file

@ -1064,9 +1064,18 @@ VfatWrite(
ByteOffset.u.LowPart + Length > Fcb->RFCB.FileSize.u.LowPart)
{
LARGE_INTEGER AllocationSize;
if (!ExAcquireResourceExclusiveLite(&IrpContext->DeviceExt->DirResource, CanWait))
{
goto ByeBye;
}
AllocationSize.QuadPart = ByteOffset.u.LowPart + Length;
Status = VfatSetAllocationSizeInformation(IrpContext->FileObject, Fcb,
IrpContext->DeviceExt, &AllocationSize);
ExReleaseResourceLite(&IrpContext->DeviceExt->DirResource);
if (!NT_SUCCESS (Status))
{
goto ByeBye;