提交 2ce9e6ab 编写于 作者: A Alon Zahavi 提交者: Zheng Zengkai

fs/ntfs3: Fix attr_punch_hole() null pointer derenference

mainline inclusion
from mainline-v6.2-rc1
commit 6d5c9e79
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I683ER
CVE: CVE-2022-4842

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6d5c9e79b726cc473d40e9cb60976dbe8e669624

--------------------------------

The bug occours due to a misuse of `attr` variable instead of `attr_b`.
`attr` is being initialized as NULL, then being derenfernced
as `attr->res.data_size`.

This bug causes a crash of the ntfs3 driver itself,
If compiled directly to the kernel, it crashes the whole system.
Signed-off-by: NAlon Zahavi <zahavi.alon@gmail.com>
Co-developed-by: NTal Lossos <tallossos@gmail.com>
Signed-off-by: NTal Lossos <tallossos@gmail.com>
Signed-off-by: NKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Signed-off-by: NZhihao Cheng <chengzhihao1@huawei.com>
Reviewed-by: NZhang Yi <yi.zhang@huawei.com>
Reviewed-by: NXiu Jianfeng <xiujianfeng@huawei.com>
Signed-off-by: NJialin Zhang <zhangjialin11@huawei.com>
上级 09b2e27a
......@@ -1949,7 +1949,7 @@ int attr_punch_hole(struct ntfs_inode *ni, u64 vbo, u64 bytes, u32 *frame_size)
return -ENOENT;
if (!attr_b->non_res) {
u32 data_size = le32_to_cpu(attr->res.data_size);
u32 data_size = le32_to_cpu(attr_b->res.data_size);
u32 from, to;
if (vbo > data_size)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册