Commit 949763b2 authored by Anton Altaparmakov's avatar Anton Altaparmakov

NTFS: Fix comparison of $MFT and $MFTMirr to not bail out when there are

      unused, invalid mft records which are the same in both $MFT and
      $MFTMirr.
Signed-off-by: default avatarAnton Altaparmakov <aia21@cantab.net>
parent 78264bd9
...@@ -28,6 +28,9 @@ ToDo/Notes: ...@@ -28,6 +28,9 @@ ToDo/Notes:
continued the attribute lookup loop instead of aborting it. continued the attribute lookup loop instead of aborting it.
- Use buffer_migrate_page() for the ->migratepage function of all ntfs - Use buffer_migrate_page() for the ->migratepage function of all ntfs
address space operations. address space operations.
- Fix comparison of $MFT and $MFTMirr to not bail out when there are
unused, invalid mft records which are the same in both $MFT and
$MFTMirr.
2.1.26 - Minor bug fixes and updates. 2.1.26 - Minor bug fixes and updates.
......
...@@ -1099,26 +1099,38 @@ static BOOL check_mft_mirror(ntfs_volume *vol) ...@@ -1099,26 +1099,38 @@ static BOOL check_mft_mirror(ntfs_volume *vol)
kmirr = page_address(mirr_page); kmirr = page_address(mirr_page);
++index; ++index;
} }
/* Make sure the record is ok. */ /* Do not check the record if it is not in use. */
if (ntfs_is_baad_recordp((le32*)kmft)) { if (((MFT_RECORD*)kmft)->flags & MFT_RECORD_IN_USE) {
ntfs_error(sb, "Incomplete multi sector transfer " /* Make sure the record is ok. */
"detected in mft record %i.", i); if (ntfs_is_baad_recordp((le32*)kmft)) {
ntfs_error(sb, "Incomplete multi sector "
"transfer detected in mft "
"record %i.", i);
mm_unmap_out: mm_unmap_out:
ntfs_unmap_page(mirr_page); ntfs_unmap_page(mirr_page);
mft_unmap_out: mft_unmap_out:
ntfs_unmap_page(mft_page); ntfs_unmap_page(mft_page);
return FALSE; return FALSE;
}
} }
if (ntfs_is_baad_recordp((le32*)kmirr)) { /* Do not check the mirror record if it is not in use. */
ntfs_error(sb, "Incomplete multi sector transfer " if (((MFT_RECORD*)kmirr)->flags & MFT_RECORD_IN_USE) {
"detected in mft mirror record %i.", i); if (ntfs_is_baad_recordp((le32*)kmirr)) {
goto mm_unmap_out; ntfs_error(sb, "Incomplete multi sector "
"transfer detected in mft "
"mirror record %i.", i);
goto mm_unmap_out;
}
} }
/* Get the amount of data in the current record. */ /* Get the amount of data in the current record. */
bytes = le32_to_cpu(((MFT_RECORD*)kmft)->bytes_in_use); bytes = le32_to_cpu(((MFT_RECORD*)kmft)->bytes_in_use);
if (!bytes || bytes > vol->mft_record_size) { if (bytes < sizeof(MFT_RECORD_OLD) ||
bytes > vol->mft_record_size ||
ntfs_is_baad_recordp((le32*)kmft)) {
bytes = le32_to_cpu(((MFT_RECORD*)kmirr)->bytes_in_use); bytes = le32_to_cpu(((MFT_RECORD*)kmirr)->bytes_in_use);
if (!bytes || bytes > vol->mft_record_size) if (bytes < sizeof(MFT_RECORD_OLD) ||
bytes > vol->mft_record_size ||
ntfs_is_baad_recordp((le32*)kmirr))
bytes = vol->mft_record_size; bytes = vol->mft_record_size;
} }
/* Compare the two records. */ /* Compare the two records. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment