diff options
author | Anton Altaparmakov <aia21@cantab.net> | 2005-04-04 11:20:14 -0400 |
---|---|---|
committer | Anton Altaparmakov <aia21@cantab.net> | 2005-05-05 06:44:41 -0400 |
commit | b0d2374d62faed034dd80e6524efb98a6341597c (patch) | |
tree | 99ae91efcc90ead7b8aa1cc44f286a528adc6545 /fs/ntfs/super.c | |
parent | 251c8427c9c418674fc3c04a11de95dc3661b560 (diff) |
NTFS: Some utilities modify the boot sector but do not update the checksum.
Thus, relax the checking in fs/ntfs/super.c::is_boot_sector_ntfs() to
only emit a warning when the checksum is incorrect rather than
refusing the mount. Thanks to Bernd Casimir for pointing this
problem out.
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
Diffstat (limited to 'fs/ntfs/super.c')
-rw-r--r-- | fs/ntfs/super.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index 25fa1d1668da..6f752ea765c3 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include "debug.h" | 38 | #include "debug.h" |
39 | #include "index.h" | 39 | #include "index.h" |
40 | #include "aops.h" | 40 | #include "aops.h" |
41 | #include "layout.h" | ||
41 | #include "malloc.h" | 42 | #include "malloc.h" |
42 | #include "ntfs.h" | 43 | #include "ntfs.h" |
43 | 44 | ||
@@ -532,16 +533,19 @@ static BOOL is_boot_sector_ntfs(const struct super_block *sb, | |||
532 | { | 533 | { |
533 | /* | 534 | /* |
534 | * Check that checksum == sum of u32 values from b to the checksum | 535 | * Check that checksum == sum of u32 values from b to the checksum |
535 | * field. If checksum is zero, no checking is done. | 536 | * field. If checksum is zero, no checking is done. We will work when |
537 | * the checksum test fails, since some utilities update the boot sector | ||
538 | * ignoring the checksum which leaves the checksum out-of-date. We | ||
539 | * report a warning if this is the case. | ||
536 | */ | 540 | */ |
537 | if ((void*)b < (void*)&b->checksum && b->checksum) { | 541 | if ((void*)b < (void*)&b->checksum && b->checksum && !silent) { |
538 | le32 *u; | 542 | le32 *u; |
539 | u32 i; | 543 | u32 i; |
540 | 544 | ||
541 | for (i = 0, u = (le32*)b; u < (le32*)(&b->checksum); ++u) | 545 | for (i = 0, u = (le32*)b; u < (le32*)(&b->checksum); ++u) |
542 | i += le32_to_cpup(u); | 546 | i += le32_to_cpup(u); |
543 | if (le32_to_cpu(b->checksum) != i) | 547 | if (le32_to_cpu(b->checksum) != i) |
544 | goto not_ntfs; | 548 | ntfs_warning(sb, "Invalid boot sector checksum."); |
545 | } | 549 | } |
546 | /* Check OEMidentifier is "NTFS " */ | 550 | /* Check OEMidentifier is "NTFS " */ |
547 | if (b->oem_id != magicNTFS) | 551 | if (b->oem_id != magicNTFS) |
@@ -591,7 +595,7 @@ static BOOL is_boot_sector_ntfs(const struct super_block *sb, | |||
591 | * many BIOSes will refuse to boot from a bootsector if the magic is | 595 | * many BIOSes will refuse to boot from a bootsector if the magic is |
592 | * incorrect, so we emit a warning. | 596 | * incorrect, so we emit a warning. |
593 | */ | 597 | */ |
594 | if (!silent && b->end_of_sector_marker != cpu_to_le16(0xaa55)) | 598 | if (!silent && b->end_of_sector_marker != const_cpu_to_le16(0xaa55)) |
595 | ntfs_warning(sb, "Invalid end of sector marker."); | 599 | ntfs_warning(sb, "Invalid end of sector marker."); |
596 | return TRUE; | 600 | return TRUE; |
597 | not_ntfs: | 601 | not_ntfs: |