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

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