ntfs3.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] ntfs3: Fix attr_punch_hole() null pointer derenference
@ 2022-08-15 11:07 Alon Zahavi
  2022-09-30 15:44 ` Konstantin Komarov
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Alon Zahavi @ 2022-08-15 11:07 UTC (permalink / raw)
  To: almaz.alexandrovich, ntfs3, linux-kernel; +Cc: Alon Zahavi, Tal Lossos

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)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] ntfs3: Fix attr_punch_hole() null pointer derenference
  2022-08-15 11:07 [PATCH] ntfs3: Fix attr_punch_hole() null pointer derenference Alon Zahavi
@ 2022-09-30 15:44 ` Konstantin Komarov
  2023-01-17 20:21 ` SeongJae Park
  2023-01-17 20:27 ` SeongJae Park
  2 siblings, 0 replies; 5+ messages in thread
From: Konstantin Komarov @ 2022-09-30 15:44 UTC (permalink / raw)
  To: Alon Zahavi, ntfs3, linux-kernel; +Cc: Tal Lossos



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!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ntfs3: Fix attr_punch_hole() null pointer derenference
  2022-08-15 11:07 [PATCH] ntfs3: Fix attr_punch_hole() null pointer derenference Alon Zahavi
  2022-09-30 15:44 ` Konstantin Komarov
@ 2023-01-17 20:21 ` SeongJae Park
  2023-01-22 13:46   ` Greg KH
  2023-01-17 20:27 ` SeongJae Park
  2 siblings, 1 reply; 5+ messages in thread
From: SeongJae Park @ 2023-01-17 20:21 UTC (permalink / raw)
  Cc: Alon Zahavi, almaz.alexandrovich, ntfs3, linux-kernel,
	Tal Lossos, stable, gregkh

Hello,

On Mon, 15 Aug 2022 14:07:12 +0300 Alon Zahavi <zahavi.alon@gmail.com> 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>

This patch has now merged in mainline as
6d5c9e79b726cc473d40e9cb60976dbe8e669624.  stable@, could you please merge this
in stable kernels?

Fixes: be71b5cba2e64 ("fs/ntfs3: Add attrib operations") # 5.14


Thanks,
SJ

> ---
>  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)
> -- 
> 2.25.1
> 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ntfs3: Fix attr_punch_hole() null pointer derenference
  2022-08-15 11:07 [PATCH] ntfs3: Fix attr_punch_hole() null pointer derenference Alon Zahavi
  2022-09-30 15:44 ` Konstantin Komarov
  2023-01-17 20:21 ` SeongJae Park
@ 2023-01-17 20:27 ` SeongJae Park
  2 siblings, 0 replies; 5+ messages in thread
From: SeongJae Park @ 2023-01-17 20:27 UTC (permalink / raw)
  Cc: Alon Zahavi, almaz.alexandrovich, ntfs3, linux-kernel,
	Tal Lossos, stable, gregkh

Hello,

On Mon, 15 Aug 2022 14:07:12 +0300 Alon Zahavi <zahavi.alon@gmail.com> 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>

This patch has now merged in mainline as
6d5c9e79b726cc473d40e9cb60976dbe8e669624.  stable@, could you please merge this
in stable kernels?

Fixes: be71b5cba2e64 ("fs/ntfs3: Add attrib operations") # 5.14


Thanks,
SJ

> ---
>  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)
> --
> 2.25.1
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ntfs3: Fix attr_punch_hole() null pointer derenference
  2023-01-17 20:21 ` SeongJae Park
@ 2023-01-22 13:46   ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2023-01-22 13:46 UTC (permalink / raw)
  To: SeongJae Park
  Cc: Alon Zahavi, almaz.alexandrovich, ntfs3, linux-kernel,
	Tal Lossos, stable

On Tue, Jan 17, 2023 at 08:21:36PM +0000, SeongJae Park wrote:
> Hello,
> 
> On Mon, 15 Aug 2022 14:07:12 +0300 Alon Zahavi <zahavi.alon@gmail.com> 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>
> 
> This patch has now merged in mainline as
> 6d5c9e79b726cc473d40e9cb60976dbe8e669624.  stable@, could you please merge this
> in stable kernels?
> 
> Fixes: be71b5cba2e64 ("fs/ntfs3: Add attrib operations") # 5.14
> 

Now queued up, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-01-22 13:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-15 11:07 [PATCH] ntfs3: Fix attr_punch_hole() null pointer derenference Alon Zahavi
2022-09-30 15:44 ` Konstantin Komarov
2023-01-17 20:21 ` SeongJae Park
2023-01-22 13:46   ` Greg KH
2023-01-17 20:27 ` SeongJae Park

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).