diff options
author | Anton Altaparmakov <aia21@cantab.net> | 2006-03-23 10:34:13 -0500 |
---|---|---|
committer | Anton Altaparmakov <aia21@cantab.net> | 2006-03-23 10:34:13 -0500 |
commit | 949763b2b8822c6dc6da0d0e1d4af092152546c2 (patch) | |
tree | 241f024e5eb4e8aeb3aa89e0e3972211e3e1c07b | |
parent | 78264bd9c239237fe356c32d08abf8e52a2d8737 (diff) |
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: Anton Altaparmakov <aia21@cantab.net>
-rw-r--r-- | fs/ntfs/ChangeLog | 3 | ||||
-rw-r--r-- | fs/ntfs/super.c | 38 |
2 files changed, 28 insertions, 13 deletions
diff --git a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog index 8df10700a930..548d9059a697 100644 --- a/fs/ntfs/ChangeLog +++ b/fs/ntfs/ChangeLog | |||
@@ -28,6 +28,9 @@ ToDo/Notes: | |||
28 | continued the attribute lookup loop instead of aborting it. | 28 | continued the attribute lookup loop instead of aborting it. |
29 | - Use buffer_migrate_page() for the ->migratepage function of all ntfs | 29 | - Use buffer_migrate_page() for the ->migratepage function of all ntfs |
30 | address space operations. | 30 | address space operations. |
31 | - Fix comparison of $MFT and $MFTMirr to not bail out when there are | ||
32 | unused, invalid mft records which are the same in both $MFT and | ||
33 | $MFTMirr. | ||
31 | 34 | ||
32 | 2.1.26 - Minor bug fixes and updates. | 35 | 2.1.26 - Minor bug fixes and updates. |
33 | 36 | ||
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index 71c58eca580e..fd4aecc5548e 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c | |||
@@ -1099,26 +1099,38 @@ static BOOL check_mft_mirror(ntfs_volume *vol) | |||
1099 | kmirr = page_address(mirr_page); | 1099 | kmirr = page_address(mirr_page); |
1100 | ++index; | 1100 | ++index; |
1101 | } | 1101 | } |
1102 | /* Make sure the record is ok. */ | 1102 | /* Do not check the record if it is not in use. */ |
1103 | if (ntfs_is_baad_recordp((le32*)kmft)) { | 1103 | if (((MFT_RECORD*)kmft)->flags & MFT_RECORD_IN_USE) { |
1104 | ntfs_error(sb, "Incomplete multi sector transfer " | 1104 | /* Make sure the record is ok. */ |
1105 | "detected in mft record %i.", i); | 1105 | if (ntfs_is_baad_recordp((le32*)kmft)) { |
1106 | ntfs_error(sb, "Incomplete multi sector " | ||
1107 | "transfer detected in mft " | ||
1108 | "record %i.", i); | ||
1106 | mm_unmap_out: | 1109 | mm_unmap_out: |
1107 | ntfs_unmap_page(mirr_page); | 1110 | ntfs_unmap_page(mirr_page); |
1108 | mft_unmap_out: | 1111 | mft_unmap_out: |
1109 | ntfs_unmap_page(mft_page); | 1112 | ntfs_unmap_page(mft_page); |
1110 | return FALSE; | 1113 | return FALSE; |
1114 | } | ||
1111 | } | 1115 | } |
1112 | if (ntfs_is_baad_recordp((le32*)kmirr)) { | 1116 | /* Do not check the mirror record if it is not in use. */ |
1113 | ntfs_error(sb, "Incomplete multi sector transfer " | 1117 | if (((MFT_RECORD*)kmirr)->flags & MFT_RECORD_IN_USE) { |
1114 | "detected in mft mirror record %i.", i); | 1118 | if (ntfs_is_baad_recordp((le32*)kmirr)) { |
1115 | goto mm_unmap_out; | 1119 | ntfs_error(sb, "Incomplete multi sector " |
1120 | "transfer detected in mft " | ||
1121 | "mirror record %i.", i); | ||
1122 | goto mm_unmap_out; | ||
1123 | } | ||
1116 | } | 1124 | } |
1117 | /* Get the amount of data in the current record. */ | 1125 | /* Get the amount of data in the current record. */ |
1118 | bytes = le32_to_cpu(((MFT_RECORD*)kmft)->bytes_in_use); | 1126 | bytes = le32_to_cpu(((MFT_RECORD*)kmft)->bytes_in_use); |
1119 | if (!bytes || bytes > vol->mft_record_size) { | 1127 | if (bytes < sizeof(MFT_RECORD_OLD) || |
1128 | bytes > vol->mft_record_size || | ||
1129 | ntfs_is_baad_recordp((le32*)kmft)) { | ||
1120 | bytes = le32_to_cpu(((MFT_RECORD*)kmirr)->bytes_in_use); | 1130 | bytes = le32_to_cpu(((MFT_RECORD*)kmirr)->bytes_in_use); |
1121 | if (!bytes || bytes > vol->mft_record_size) | 1131 | if (bytes < sizeof(MFT_RECORD_OLD) || |
1132 | bytes > vol->mft_record_size || | ||
1133 | ntfs_is_baad_recordp((le32*)kmirr)) | ||
1122 | bytes = vol->mft_record_size; | 1134 | bytes = vol->mft_record_size; |
1123 | } | 1135 | } |
1124 | /* Compare the two records. */ | 1136 | /* Compare the two records. */ |