[VFATLIB]

Fix a really bad bug in VfatChkdsk(), the routine used to check a volume:
In case readwrite is enabled (ie, volume fixing is allowed), when the volume is opened, it is also locked.
If the volume has the clean shutdown bit and is to be checked only if that one is not set, then the volume lock is leaked.
This makes the volume then totally unusable later on (any later open will fail).

Because r75772 fixed volume locking on non-system partition, this totally broke (access denied) any secondary FAT volume in ROS.

Now, we just properly release the lock when required, also made a comment more explicit to avoid later bugs like that.

CORE-13805

svn path=/trunk/; revision=75911
This commit is contained in:
Pierre Schweitzer 2017-09-20 08:45:28 +00:00
parent 84fd9647d3
commit 2ac2acf2d7

View file

@ -402,11 +402,15 @@ VfatChkdsk(IN PUNICODE_STRING DriveRoot,
verify = TRUE;
salvage_files = TRUE;
/* Open filesystem */
/* Open filesystem and lock it */
fs_open(DriveRoot, FsCheckFlags & FSCHECK_READ_WRITE);
if (CheckOnlyIfDirty && !fs_isdirty())
{
/* Unlock volume if required */
if (FsCheckFlags & FSCHECK_READ_WRITE)
fs_lock(FALSE);
/* No need to check FS */
return (fs_close(FALSE) == 0 ? STATUS_SUCCESS : STATUS_DISK_CORRUPT_ERROR);
}