2023-08-08 17:34:45

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] ntfs : fix shift-out-of-bounds in ntfs_iget

On Tue, Aug 08, 2023 at 10:04:05AM +0530, Manas Ghandat wrote:
> Added a check to the compression_unit so that out of bound doesn't
> occur.
>
> Signed-off-by: Manas Ghandat <[email protected]>
> Reported-by: [email protected]
> ---
> fs/ntfs/inode.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
> index 6c3f38d66579..2ee100a7df32 100644
> --- a/fs/ntfs/inode.c
> +++ b/fs/ntfs/inode.c
> @@ -1077,6 +1077,17 @@ static int ntfs_read_locked_inode(struct inode *vi)
> goto unm_err_out;
> }
> if (a->data.non_resident.compression_unit) {
> + if(a->data.non_resident.compression_unit +
> + vol->cluster_size_bits > 32) {
> + ntfs_error(vi->i_sb, "Found "
> + "non-standard "
> + "compression unit (%u). "
> + "Cannot handle this.",

Please do not split strings across lines.

And checkpatch will find other problems with this change as well, did
you run it before submitting it.

thanks,

greg k-h


2023-08-08 17:49:02

by Manas Ghandat

[permalink] [raw]
Subject: [PATCH v2] ntfs : fix shift-out-of-bounds in ntfs_iget

Added a check to the compression_unit so that out of bound doesn't occur.

Fix patching issues in version 2.

Signed-off-by: Manas Ghandat <[email protected]>
Reported-by: [email protected]
Closes: https://syzkaller.appspot.com/bug?extid=4768a8f039aa677897d0
---
fs/ntfs/inode.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index 6c3f38d66579..a657322874ed 100644
--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -1077,6 +1077,15 @@ static int ntfs_read_locked_inode(struct inode *vi)
goto unm_err_out;
}
if (a->data.non_resident.compression_unit) {
+ if (a->data.non_resident.compression_unit +
+ vol->cluster_size_bits > 32) {
+ ntfs_error(vi->i_sb,
+ "Found non-standard compression unit (%u). Cannot handle this.",
+ a->data.non_resident.compression_unit
+ );
+ err = -EOPNOTSUPP;
+ goto unm_err_out;
+ }
ni->itype.compressed.block_size = 1U <<
(a->data.non_resident.
compression_unit +
--
2.37.2


2023-08-08 19:55:07

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v2] ntfs : fix shift-out-of-bounds in ntfs_iget

On Tue, Aug 08, 2023 at 08:45:02PM +0530, Manas Ghandat wrote:
> In the above patch I have mentioned what are the changes from the version
> 1. Also since most of the lines of the patch were a change due to some
> indentation error, the whole patch appears as the diff.

As my bot said:

> > - This looks like a new version of a previously submitted patch, but you
> > did not list below the --- line any changes from the previous version.
> > Please read the section entitled "The canonical patch format" in the
> > kernel file, Documentation/process/submitting-patches.rst for what
> > needs to be done here to properly describe this.

Please read that and submit a new patch based on the requirements there.

thanks,

greg k-h

2023-08-08 19:59:30

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v2] ntfs : fix shift-out-of-bounds in ntfs_iget

On Tue, Aug 08, 2023 at 03:59:58PM +0530, Manas Ghandat wrote:
> Added a check to the compression_unit so that out of bound doesn't occur.
>
> Fix patching issues in version 2.
>
> Signed-off-by: Manas Ghandat <[email protected]>
> Reported-by: [email protected]
> Closes: https://syzkaller.appspot.com/bug?extid=4768a8f039aa677897d0
> ---
> fs/ntfs/inode.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
> index 6c3f38d66579..a657322874ed 100644
> --- a/fs/ntfs/inode.c
> +++ b/fs/ntfs/inode.c
> @@ -1077,6 +1077,15 @@ static int ntfs_read_locked_inode(struct inode *vi)
> goto unm_err_out;
> }
> if (a->data.non_resident.compression_unit) {
> + if (a->data.non_resident.compression_unit +
> + vol->cluster_size_bits > 32) {
> + ntfs_error(vi->i_sb,
> + "Found non-standard compression unit (%u). Cannot handle this.",
> + a->data.non_resident.compression_unit
> + );
> + err = -EOPNOTSUPP;
> + goto unm_err_out;
> + }
> ni->itype.compressed.block_size = 1U <<
> (a->data.non_resident.
> compression_unit +
> --
> 2.37.2
>

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- This looks like a new version of a previously submitted patch, but you
did not list below the --- line any changes from the previous version.
Please read the section entitled "The canonical patch format" in the
kernel file, Documentation/process/submitting-patches.rst for what
needs to be done here to properly describe this.


If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot

2023-08-10 16:41:40

by Manas Ghandat

[permalink] [raw]
Subject: [PATCH v3] ntfs : fix shift-out-of-bounds in ntfs_iget

Added a check to the compression_unit so that out of bound doesn't occur.

Signed-off-by: Manas Ghandat <[email protected]>
Reported-by: [email protected]
Closes: https://syzkaller.appspot.com/bug?extid=4768a8f039aa677897d0
---
V2 -> V3: Fix patching issue.
V1 -> V2: Cleaned up coding style.

fs/ntfs/inode.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index 6c3f38d66579..a657322874ed 100644
--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -1077,6 +1077,15 @@ static int ntfs_read_locked_inode(struct inode *vi)
goto unm_err_out;
}
if (a->data.non_resident.compression_unit) {
+ if (a->data.non_resident.compression_unit +
+ vol->cluster_size_bits > 32) {
+ ntfs_error(vi->i_sb,
+ "Found non-standard compression unit (%u). Cannot handle this.",
+ a->data.non_resident.compression_unit
+ );
+ err = -EOPNOTSUPP;
+ goto unm_err_out;
+ }
ni->itype.compressed.block_size = 1U <<
(a->data.non_resident.
compression_unit +
--
2.37.2


2023-08-10 18:52:31

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v3] ntfs : fix shift-out-of-bounds in ntfs_iget

On Thu, Aug 10, 2023 at 09:43:08PM +0530, Manas Ghandat wrote:
> Added a check to the compression_unit so that out of bound doesn't occur.

This probably needs more text to describe what is happening.


>
> Signed-off-by: Manas Ghandat <[email protected]>
> Reported-by: [email protected]
> Closes: https://syzkaller.appspot.com/bug?extid=4768a8f039aa677897d0

What commit id does this fix? Should it go to stable kernels?


> ---
> V2 -> V3: Fix patching issue.
> V1 -> V2: Cleaned up coding style.
>
> fs/ntfs/inode.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
> index 6c3f38d66579..a657322874ed 100644
> --- a/fs/ntfs/inode.c
> +++ b/fs/ntfs/inode.c
> @@ -1077,6 +1077,15 @@ static int ntfs_read_locked_inode(struct inode *vi)
> goto unm_err_out;
> }
> if (a->data.non_resident.compression_unit) {
> + if (a->data.non_resident.compression_unit +
> + vol->cluster_size_bits > 32) {

Should be indented a bit left, right?

> + ntfs_error(vi->i_sb,
> + "Found non-standard compression unit (%u). Cannot handle this.",

Why all the extra ' ' characters?

thanks,

greg k-h