diff options
author | Huacai Chen <chenhuacai@loongson.cn> | 2024-05-29 14:40:52 +0800 |
---|---|---|
committer | Konstantin Komarov <almaz.alexandrovich@paragon-software.com> | 2024-07-11 12:19:46 +0300 |
commit | 2fef55d8f78383c8e6d6d4c014b9597375132696 (patch) | |
tree | e604a145f305f59ec4dd66bd6df09a1ce5af6c97 /fs/ntfs3/fslog.c | |
parent | 5bfb91c71207ef3f0058701eeca86d96c0a39447 (diff) |
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: stable@vger.kernel.org
Fixes: b46acd6a6a627d876898e ("fs/ntfs3: Add NTFS journal")
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Diffstat (limited to 'fs/ntfs3/fslog.c')
-rw-r--r-- | fs/ntfs3/fslog.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c index f8da043be169..5ee923904b6a 100644 --- a/fs/ntfs3/fslog.c +++ b/fs/ntfs3/fslog.c @@ -3922,6 +3922,9 @@ check_restart_area: goto out; } + log->page_mask = log->page_size - 1; + log->page_bits = blksize_bits(log->page_size); + /* If the file size has shrunk then we won't mount it. */ if (log->l_size < le64_to_cpu(ra2->l_size)) { err = -EINVAL; |