Skip to content

Commit 28373a9

Browse files
authored
[NTOS:IO] Do not free the active VPB (reactos#9343)
IopDereferenceVpbAndFree frees a zero-reference VPB only while it is still installed in RealDevice->Vpb. This can leave the device with a dangling VPB pointer while detached VPBs are retained. Reverse the identity test so only a detached, nonpersistent VPB is released after its reference count reaches zero. Reference: - https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_vpb
1 parent 6c515f5 commit 28373a9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎ntoskrnl/io/iomgr/volume.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ IopDereferenceVpbAndFree(IN PVPB Vpb)
192192
Vpb->ReferenceCount--;
193193

194194
/* Check if we're out of references */
195-
if (!Vpb->ReferenceCount && Vpb->RealDevice->Vpb == Vpb &&
195+
if (!Vpb->ReferenceCount && Vpb->RealDevice->Vpb != Vpb &&
196196
!(Vpb->Flags & VPB_PERSISTENT))
197197
{
198198
/* Release VPB lock */

0 commit comments

Comments
 (0)