Cherry pick aa04ca0ea4cadb0c70ff6d659916cc98b7b02c27: uninit: don't free roots before FCBs are freed

This avoids use-after-free on shutdown

svn path=/trunk/; revision=71314
This commit is contained in:
Pierre Schweitzer 2016-05-10 21:07:56 +00:00
parent ece9acc307
commit e1036d5ff1

View file

@ -2374,6 +2374,13 @@ void STDCALL uninit(device_extension* Vcb, BOOL flush) {
release_tree_lock(Vcb, TRUE);
}
// FIXME - stop async threads
free_fcb(Vcb->volume_fcb);
free_fileref(Vcb->root_fileref);
// FIXME - free any open fcbs?
while (!IsListEmpty(&Vcb->roots)) {
LIST_ENTRY* le = RemoveHeadList(&Vcb->roots);
@ -2402,9 +2409,6 @@ void STDCALL uninit(device_extension* Vcb, BOOL flush) {
ExFreePool(c);
}
free_fcb(Vcb->volume_fcb);
free_fileref(Vcb->root_fileref);
for (i = 0; i < Vcb->superblock.num_devices; i++) {
while (!IsListEmpty(&Vcb->devices[i].disk_holes)) {
LIST_ENTRY* le = RemoveHeadList(&Vcb->devices[i].disk_holes);