[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230815052251.107732-1-ghandatmanas@gmail.com>
Date: Tue, 15 Aug 2023 10:52:50 +0530
From: Manas Ghandat <ghandatmanas@...il.com>
To: anton@...era.com, linkinjeon@...nel.org
Cc: Manas Ghandat <ghandatmanas@...il.com>,
Linux-kernel-mentees@...ts.linuxfoundation.org,
gregkh@...uxfoundation.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-ntfs-dev@...ts.sourceforge.net,
syzbot+4768a8f039aa677897d0@...kaller.appspotmail.com
Subject: [PATCH v5] ntfs : fix shift-out-of-bounds in ntfs_iget
Currently there is not check for ni->itype.compressed.block_size when
a->data.non_resident.compression_unit is present and NInoSparse(ni) is
true. Added the correct check to the compression unit.
Signed-off-by: Manas Ghandat <ghandatmanas@...il.com>
Reported-by: syzbot+4768a8f039aa677897d0@...kaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=4768a8f039aa677897d0
Fix-commit-ID: upstream f40ddce88593482919761f74910f42f4b84c004b
---
V4 -> V5: Add recommended check to compression_unit
V3 -> V4: Fix description
V2 -> V3: Fix patching issue.
V1 -> V2: Cleaned up coding style.
fs/ntfs/inode.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index 6c3f38d66579..d8ac221f212b 100644
--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -1076,6 +1076,16 @@ static int ntfs_read_locked_inode(struct inode *vi)
err = -EOPNOTSUPP;
goto unm_err_out;
}
+ if (NInoSparse(ni) && a->data.non_resident.compression_unit &&
+ a->data.non_resident.compression_unit !=
+ vol->sparse_compression_unit) {
+ ntfs_error(vi->i_sb,
+ "Found non-standard compression unit (%u instead of 0 or %d). Cannot handle this.",
+ a->data.non_resident.compression_unit,
+ vol->sparse_compression_unit);
+ err = -EOPNOTSUPP;
+ goto unm_err_out;
+ }
if (a->data.non_resident.compression_unit) {
ni->itype.compressed.block_size = 1U <<
(a->data.non_resident.
--
2.37.2
Powered by blists - more mailing lists