lkml.org 
[lkml]   [2022]   [Sep]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] ntfs3: Fix attr_punch_hole() null pointer derenference
From


On 8/15/22 14:07, Alon Zahavi wrote:
> From: Alon Zahavi <zahavi.alon@gmail.com>
>
> 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>
> ---
> fs/ntfs3/attrib.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c
> index e8c00dda42ad..4e74bc8f01ed 100644
> --- a/fs/ntfs3/attrib.c
> +++ b/fs/ntfs3/attrib.c
> @@ -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)

Applied, thanks!

\
 
 \ /
  Last update: 2022-09-30 17:45    [W:0.047 / U:4.472 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site