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>
This commit is contained in:
parent
251c8427c9
commit
b0d2374d62
|
@ -105,6 +105,11 @@ ToDo/Notes:
|
||||||
non-resident by a concurrent file write.
|
non-resident by a concurrent file write.
|
||||||
- Remove checks for NULL before calling kfree() since kfree() does the
|
- Remove checks for NULL before calling kfree() since kfree() does the
|
||||||
checking itself. (Jesper Juhl)
|
checking itself. (Jesper Juhl)
|
||||||
|
- 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.
|
||||||
|
|
||||||
2.1.22 - Many bug and race fixes and error handling improvements.
|
2.1.22 - Many bug and race fixes and error handling improvements.
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "index.h"
|
#include "index.h"
|
||||||
#include "aops.h"
|
#include "aops.h"
|
||||||
|
#include "layout.h"
|
||||||
#include "malloc.h"
|
#include "malloc.h"
|
||||||
#include "ntfs.h"
|
#include "ntfs.h"
|
||||||
|
|
||||||
|
@ -532,16 +533,19 @@ static BOOL is_boot_sector_ntfs(const struct super_block *sb,
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Check that checksum == sum of u32 values from b to the checksum
|
* Check that checksum == sum of u32 values from b to the checksum
|
||||||
* field. If checksum is zero, no checking is done.
|
* field. If checksum is zero, no checking is done. We will work when
|
||||||
|
* the checksum test fails, since some utilities update the boot sector
|
||||||
|
* ignoring the checksum which leaves the checksum out-of-date. We
|
||||||
|
* report a warning if this is the case.
|
||||||
*/
|
*/
|
||||||
if ((void*)b < (void*)&b->checksum && b->checksum) {
|
if ((void*)b < (void*)&b->checksum && b->checksum && !silent) {
|
||||||
le32 *u;
|
le32 *u;
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
for (i = 0, u = (le32*)b; u < (le32*)(&b->checksum); ++u)
|
for (i = 0, u = (le32*)b; u < (le32*)(&b->checksum); ++u)
|
||||||
i += le32_to_cpup(u);
|
i += le32_to_cpup(u);
|
||||||
if (le32_to_cpu(b->checksum) != i)
|
if (le32_to_cpu(b->checksum) != i)
|
||||||
goto not_ntfs;
|
ntfs_warning(sb, "Invalid boot sector checksum.");
|
||||||
}
|
}
|
||||||
/* Check OEMidentifier is "NTFS " */
|
/* Check OEMidentifier is "NTFS " */
|
||||||
if (b->oem_id != magicNTFS)
|
if (b->oem_id != magicNTFS)
|
||||||
|
@ -591,7 +595,7 @@ static BOOL is_boot_sector_ntfs(const struct super_block *sb,
|
||||||
* many BIOSes will refuse to boot from a bootsector if the magic is
|
* many BIOSes will refuse to boot from a bootsector if the magic is
|
||||||
* incorrect, so we emit a warning.
|
* incorrect, so we emit a warning.
|
||||||
*/
|
*/
|
||||||
if (!silent && b->end_of_sector_marker != cpu_to_le16(0xaa55))
|
if (!silent && b->end_of_sector_marker != const_cpu_to_le16(0xaa55))
|
||||||
ntfs_warning(sb, "Invalid end of sector marker.");
|
ntfs_warning(sb, "Invalid end of sector marker.");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
not_ntfs:
|
not_ntfs:
|
||||||
|
|
Loading…
Reference in a new issue