From: Konstantin Komarov almaz.alexandrovich@paragon-software.com
mainline inclusion from mainline-v6.10-rc1 commit 1cd6c96219c429ebcfa8e79a865277376c563803 category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/IA7D7V CVE: CVE-2024-38625
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i...
--------------------------------
It can be NULL if bmap is called.
Fixes: 82cae269cfa95 ("fs/ntfs3: Add initialization of super block") Signed-off-by: Konstantin Komarov almaz.alexandrovich@paragon-software.com Conflicts: fs/ntfs3/inode.c [Page has not converted to a folio yet, and the alternative boot feature has not been merged.] Signed-off-by: Wang Zhaolong wangzhaolong1@huawei.com --- fs/ntfs3/inode.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index 9bafa3c7a5ff..97caf47507d0 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -565,13 +565,17 @@ static noinline int ntfs_get_block_vbo(struct inode *inode, u64 vbo, }
if (is_resident(ni)) { - ni_lock(ni); - err = attr_data_read_resident(ni, page); - ni_unlock(ni); - - if (!err) - set_buffer_uptodate(bh); bh->b_size = block_size; + if (!page) { + err = 0; + } else { + ni_lock(ni); + err = attr_data_read_resident(ni, page); + ni_unlock(ni); + + if (!err) + set_buffer_uptodate(bh); + } return err; }