mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 01:49:46 +00:00
fs/ntfs3: Fix memory corruption when page_size changes
The rework in fs/ntfs3: Reduce stack usage
changes log->page_size but doesn't change the associated
log->page_mask and log->page_bits.
That results in the bytes value in read_log_page
getting a negative value, which is bad when it is
passed to memcpy.
The kernel panic can be observed when connecting an
ntfs formatted drive that has previously been connected
to a Windows machine to a Raspberry Pi 5, which by defauilt
uses a 16K kernel pagesize.
Fixes: 865e7a7700 ("fs/ntfs3: Reduce stack usage")
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
This commit is contained in:
@@ -3914,6 +3914,8 @@ check_restart_area:
|
||||
log->l_size = log->orig_file_size;
|
||||
log->page_size = norm_file_page(t32, &log->l_size,
|
||||
t32 == DefaultLogPageSize);
|
||||
log->page_mask = log->page_size - 1;
|
||||
log->page_bits = blksize_bits(log->page_size);
|
||||
}
|
||||
|
||||
if (log->page_size != t32 ||
|
||||
|
||||
Reference in New Issue
Block a user