mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
fs/ntfs3: Update log->page_{mask,bits} if log->page_size changed
commit 2fef55d8f78383c8e6d6d4c014b9597375132696 upstream.
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: b46acd6a6a
("fs/ntfs3: Add NTFS journal")
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
f17cbe5545
commit
2cac0df332
1 changed files with 3 additions and 0 deletions
|
@ -3922,6 +3922,9 @@ check_restart_area:
|
||||||
goto out;
|
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 the file size has shrunk then we won't mount it. */
|
||||||
if (log->l_size < le64_to_cpu(ra2->l_size)) {
|
if (log->l_size < le64_to_cpu(ra2->l_size)) {
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue