Skip to content

Commit 2fef55d

Browse files
chenhuacaiaalexandrovich
authored andcommitted
fs/ntfs3: Update log->page_{mask,bits} if log->page_size changed
If an NTFS file system is mounted to another system with different PAGE_SIZE from the original system, log->page_size will change in log_replay(), but log->page_{mask,bits} don't change correspondingly. This will cause a panic because "u32 bytes = log->page_size - page_off" will get a negative value in the later read_log_page(). Cc: [email protected] Fixes: b46acd6 ("fs/ntfs3: Add NTFS journal") Signed-off-by: Huacai Chen <[email protected]> Signed-off-by: Konstantin Komarov <[email protected]>
1 parent 5bfb91c commit 2fef55d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fs/ntfs3/fslog.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3922,6 +3922,9 @@ int log_replay(struct ntfs_inode *ni, bool *initialized)
39223922
goto out;
39233923
}
39243924

3925+
log->page_mask = log->page_size - 1;
3926+
log->page_bits = blksize_bits(log->page_size);
3927+
39253928
/* If the file size has shrunk then we won't mount it. */
39263929
if (log->l_size < le64_to_cpu(ra2->l_size)) {
39273930
err = -EINVAL;

0 commit comments

Comments
 (0)