linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ntfs : fix shift-out-of-bounds in ntfs_iget
@ 2023-08-08  4:34 Manas Ghandat
  2023-08-08  5:27 ` Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: Manas Ghandat @ 2023-08-08  4:34 UTC (permalink / raw)
  To: anton, linkinjeon
  Cc: Manas Ghandat, linux-ntfs-dev, linux-kernel, linux-fsdevel,
	Linux-kernel-mentees, syzbot+4768a8f039aa677897d0

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

Signed-off-by: Manas Ghandat <ghandatmanas@gmail.com>
Reported-by: syzbot+4768a8f039aa677897d0@syzkaller.appspotmail.com
---
 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.",
+								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


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

* Re: [PATCH] ntfs : fix shift-out-of-bounds in ntfs_iget
  2023-08-08  4:34 [PATCH] ntfs : fix shift-out-of-bounds in ntfs_iget Manas Ghandat
@ 2023-08-08  5:27 ` Greg KH
  2023-08-08 10:29   ` [PATCH v2] " Manas Ghandat
  0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2023-08-08  5:27 UTC (permalink / raw)
  To: Manas Ghandat
  Cc: anton, linkinjeon, linux-ntfs-dev, linux-kernel,
	syzbot+4768a8f039aa677897d0, linux-fsdevel, Linux-kernel-mentees

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 <ghandatmanas@gmail.com>
> Reported-by: syzbot+4768a8f039aa677897d0@syzkaller.appspotmail.com
> ---
>  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

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

* [PATCH v2] ntfs : fix shift-out-of-bounds in ntfs_iget
  2023-08-08  5:27 ` Greg KH
@ 2023-08-08 10:29   ` Manas Ghandat
  2023-08-08 10:45     ` Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: Manas Ghandat @ 2023-08-08 10:29 UTC (permalink / raw)
  To: gregkh
  Cc: Manas Ghandat, Linux-kernel-mentees, anton, linkinjeon,
	linux-fsdevel, linux-kernel, linux-ntfs-dev,
	syzbot+4768a8f039aa677897d0

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 <ghandatmanas@gmail.com>
Reported-by: syzbot+4768a8f039aa677897d0@syzkaller.appspotmail.com
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


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

* Re: [PATCH v2] ntfs : fix shift-out-of-bounds in ntfs_iget
  2023-08-08 10:29   ` [PATCH v2] " Manas Ghandat
@ 2023-08-08 10:45     ` Greg KH
       [not found]       ` <CAEt2hJ5icep5dF_OhuZwe0zig4VKCTKuQ0=iYfpOek7Ebp12Lw@mail.gmail.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2023-08-08 10:45 UTC (permalink / raw)
  To: Manas Ghandat
  Cc: Linux-kernel-mentees, anton, linkinjeon, linux-fsdevel,
	linux-kernel, linux-ntfs-dev, syzbot+4768a8f039aa677897d0

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 <ghandatmanas@gmail.com>
> Reported-by: syzbot+4768a8f039aa677897d0@syzkaller.appspotmail.com
> 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

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

* Re: [PATCH v2] ntfs : fix shift-out-of-bounds in ntfs_iget
       [not found]       ` <CAEt2hJ5icep5dF_OhuZwe0zig4VKCTKuQ0=iYfpOek7Ebp12Lw@mail.gmail.com>
@ 2023-08-08 16:36         ` Greg KH
  2023-08-10 16:13           ` [PATCH v3] " Manas Ghandat
  0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2023-08-08 16:36 UTC (permalink / raw)
  To: Manas Ghandat
  Cc: Linux-kernel-mentees, anton, linkinjeon, linux-fsdevel,
	linux-kernel, linux-ntfs-dev, syzbot+4768a8f039aa677897d0

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

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

* [PATCH v3] ntfs : fix shift-out-of-bounds in ntfs_iget
  2023-08-08 16:36         ` Greg KH
@ 2023-08-10 16:13           ` Manas Ghandat
  2023-08-10 17:32             ` Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: Manas Ghandat @ 2023-08-10 16:13 UTC (permalink / raw)
  To: gregkh
  Cc: Manas Ghandat, Linux-kernel-mentees, anton, linkinjeon,
	linux-fsdevel, linux-kernel, linux-ntfs-dev,
	syzbot+4768a8f039aa677897d0

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

Signed-off-by: Manas Ghandat <ghandatmanas@gmail.com>
Reported-by: syzbot+4768a8f039aa677897d0@syzkaller.appspotmail.com
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


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

* Re: [PATCH v3] ntfs : fix shift-out-of-bounds in ntfs_iget
  2023-08-10 16:13           ` [PATCH v3] " Manas Ghandat
@ 2023-08-10 17:32             ` Greg KH
  0 siblings, 0 replies; 7+ messages in thread
From: Greg KH @ 2023-08-10 17:32 UTC (permalink / raw)
  To: Manas Ghandat
  Cc: Linux-kernel-mentees, anton, linkinjeon, linux-fsdevel,
	linux-kernel, linux-ntfs-dev, syzbot+4768a8f039aa677897d0

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 <ghandatmanas@gmail.com>
> Reported-by: syzbot+4768a8f039aa677897d0@syzkaller.appspotmail.com
> 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

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

end of thread, other threads:[~2023-08-10 17:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-08  4:34 [PATCH] ntfs : fix shift-out-of-bounds in ntfs_iget Manas Ghandat
2023-08-08  5:27 ` Greg KH
2023-08-08 10:29   ` [PATCH v2] " Manas Ghandat
2023-08-08 10:45     ` Greg KH
     [not found]       ` <CAEt2hJ5icep5dF_OhuZwe0zig4VKCTKuQ0=iYfpOek7Ebp12Lw@mail.gmail.com>
2023-08-08 16:36         ` Greg KH
2023-08-10 16:13           ` [PATCH v3] " Manas Ghandat
2023-08-10 17:32             ` Greg KH

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