mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-25 12:00:22 +09:00
fs/ntfs3: Mark ntfs dirty when on-disk struct is corrupted
[ Upstream commit e0f363a988 ]
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
3a00ec562f
commit
c7d8b5f46f
@@ -154,7 +154,7 @@ int ntfs_fix_post_read(struct NTFS_RECORD_HEADER *rhdr, size_t bytes,
|
||||
/* Check errors. */
|
||||
if ((fo & 1) || fo + fn * sizeof(short) > SECTOR_SIZE || !fn-- ||
|
||||
fn * SECTOR_SIZE > bytes) {
|
||||
return -EINVAL; /* Native chkntfs returns ok! */
|
||||
return -E_NTFS_CORRUPT;
|
||||
}
|
||||
|
||||
/* Get fixup pointer. */
|
||||
|
||||
@@ -1112,6 +1112,12 @@ ok:
|
||||
*node = in;
|
||||
|
||||
out:
|
||||
if (err == -E_NTFS_CORRUPT) {
|
||||
ntfs_inode_err(&ni->vfs_inode, "directory corrupted");
|
||||
ntfs_set_state(ni->mi.sbi, NTFS_DIRTY_ERROR);
|
||||
err = -EINVAL;
|
||||
}
|
||||
|
||||
if (ib != in->index)
|
||||
kfree(ib);
|
||||
|
||||
|
||||
@@ -54,6 +54,8 @@ enum utf16_endian;
|
||||
#define E_NTFS_NONRESIDENT 556
|
||||
/* NTFS specific error code about punch hole. */
|
||||
#define E_NTFS_NOTALIGNED 557
|
||||
/* NTFS specific error code when on-disk struct is corrupted. */
|
||||
#define E_NTFS_CORRUPT 558
|
||||
|
||||
|
||||
/* sbi->flags */
|
||||
|
||||
@@ -180,6 +180,12 @@ ok:
|
||||
return 0;
|
||||
|
||||
out:
|
||||
if (err == -E_NTFS_CORRUPT) {
|
||||
ntfs_err(sbi->sb, "mft corrupted");
|
||||
ntfs_set_state(sbi, NTFS_DIRTY_ERROR);
|
||||
err = -EINVAL;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user