summaryrefslogtreecommitdiff
path: root/fs/ntfs3/attrib.c
diff options
context:
space:
mode:
authorAlon Zahavi <zahavi.alon@gmail.com>2022-08-15 14:07:12 +0300
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>2022-09-30 17:39:50 +0300
commit6d5c9e79b726cc473d40e9cb60976dbe8e669624 (patch)
tree06efd61e38ceda6eb669fe14c42ad7284c5f03ec /fs/ntfs3/attrib.c
parentf27b92ec0926efa3eadcebb97a90faba12e16041 (diff)
fs/ntfs3: Fix attr_punch_hole() null pointer derenference
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: Alon Zahavi <zahavi.alon@gmail.com> Co-developed-by: Tal Lossos <tallossos@gmail.com> Signed-off-by: Tal Lossos <tallossos@gmail.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Diffstat (limited to 'fs/ntfs3/attrib.c')
-rw-r--r--fs/ntfs3/attrib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c
index 578c2bcfb1d9..63169529b52c 100644
--- a/fs/ntfs3/attrib.c
+++ b/fs/ntfs3/attrib.c
@@ -2038,7 +2038,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)