Skip to content

Commit 4af12f4

Browse files
HeisSpiterJoachimHenze
authored andcommitted
[0.4.9] cherry-pick [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 ;-). (cherry picked from commit 30b836b)
1 parent a04d7c3 commit 4af12f4

File tree

1 file changed

+9
-0
lines changed
  • drivers/filesystems/fastfat

1 file changed

+9
-0
lines changed

drivers/filesystems/fastfat/rw.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,9 +1064,18 @@ VfatWrite(
10641064
ByteOffset.u.LowPart + Length > Fcb->RFCB.FileSize.u.LowPart)
10651065
{
10661066
LARGE_INTEGER AllocationSize;
1067+
1068+
if (!ExAcquireResourceExclusiveLite(&IrpContext->DeviceExt->DirResource, CanWait))
1069+
{
1070+
goto ByeBye;
1071+
}
1072+
10671073
AllocationSize.QuadPart = ByteOffset.u.LowPart + Length;
10681074
Status = VfatSetAllocationSizeInformation(IrpContext->FileObject, Fcb,
10691075
IrpContext->DeviceExt, &AllocationSize);
1076+
1077+
ExReleaseResourceLite(&IrpContext->DeviceExt->DirResource);
1078+
10701079
if (!NT_SUCCESS (Status))
10711080
{
10721081
goto ByeBye;

0 commit comments

Comments
 (0)