mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
[NTFS] Fix use after free in failure case of NtfsMountVolume.
NtfsGetVolumeData frees FileRecLookasideList in case of failure, so don't free it again. Dereferencing NewDeviceObject invalidates Vcb.
This commit is contained in:
parent
88f7be101a
commit
bd7121862a
1 changed files with 5 additions and 5 deletions
|
@ -452,8 +452,6 @@ NtfsMountVolume(PDEVICE_OBJECT DeviceObject,
|
|||
if (!NT_SUCCESS(Status))
|
||||
goto ByeBye;
|
||||
|
||||
Lookaside = TRUE;
|
||||
|
||||
NewDeviceObject->Flags |= DO_DIRECT_IO;
|
||||
Vcb = (PVOID)NewDeviceObject->DeviceExtension;
|
||||
RtlZeroMemory(Vcb, sizeof(NTFS_VCB));
|
||||
|
@ -466,6 +464,8 @@ NtfsMountVolume(PDEVICE_OBJECT DeviceObject,
|
|||
if (!NT_SUCCESS(Status))
|
||||
goto ByeBye;
|
||||
|
||||
Lookaside = TRUE;
|
||||
|
||||
NewDeviceObject->Vpb = DeviceToMount->Vpb;
|
||||
|
||||
Vcb->StorageDevice = DeviceToMount;
|
||||
|
@ -564,11 +564,11 @@ ByeBye:
|
|||
if (Ccb)
|
||||
ExFreePool(Ccb);
|
||||
|
||||
if (NewDeviceObject)
|
||||
IoDeleteDevice(NewDeviceObject);
|
||||
|
||||
if (Lookaside)
|
||||
ExDeleteNPagedLookasideList(&Vcb->FileRecLookasideList);
|
||||
|
||||
if (NewDeviceObject)
|
||||
IoDeleteDevice(NewDeviceObject);
|
||||
}
|
||||
|
||||
DPRINT("NtfsMountVolume() done (Status: %lx)\n", Status);
|
||||
|
|
Loading…
Reference in a new issue