[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <000000000000ea89ee0621be9fc5@google.com>
Date: Tue, 10 Sep 2024 00:14:30 -0700
From: syzbot <syzbot+7a2ba6b7b66340cff225@...kaller.appspotmail.com>
To: linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com
Subject: Re: [syzbot] possible fix (linux-ntfs3)
For archival purposes, forwarding an incoming command email to
linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com.
***
Subject: possible fix (linux-ntfs3)
Author: almaz.alexandrovich@...agon-software.com
Not sure about all indexes on volume must have the same index_block_size.
#syz test: https://github.com/Paragon-Software-Group/linux-ntfs3.git master
diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c
index 9089c58a005c..63fbb8ba6e1b 100644
--- a/fs/ntfs3/index.c
+++ b/fs/ntfs3/index.c
@@ -892,7 +892,9 @@ int indx_init(struct ntfs_index *indx, struct ntfs_sb_info *sbi,
indx->idx2vbn_bits = __ffs(root->index_block_clst);
t32 = le32_to_cpu(root->index_block_size);
- indx->index_bits = blksize_bits(t32);
+ if (t32 != sbi->index_size)
+ goto out;
+ indx->index_bits = sbi->index_bits;
/* Check index record size. */
if (t32 < sbi->cluster_size) {
diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h
index 3dd6215316e4..73d72fa8ab65 100644
--- a/fs/ntfs3/ntfs_fs.h
+++ b/fs/ntfs3/ntfs_fs.h
@@ -222,8 +222,9 @@ struct ntfs_sb_info {
u32 record_size;
u32 index_size;
- u8 cluster_bits;
- u8 record_bits;
+ u8 cluster_bits; // log2(cluster_size)
+ u8 record_bits; // log2(record_size)
+ u8 index_bits; // log2(index_size)
u64 maxbytes; // Maximum size for normal files.
u64 maxbytes_sparse; // Maximum size for sparse file.
diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
index 128d49512f5d..f96641b80869 100644
--- a/fs/ntfs3/super.c
+++ b/fs/ntfs3/super.c
@@ -993,6 +993,7 @@ static int ntfs_init_from_boot(struct super_block *sb, u32 sector_size,
sbi->index_size);
goto out;
}
+ sbi->index_bits = blksize_bits(sbi->index_size);
sbi->volume.size = sectors * boot_sector_size;
Powered by blists - more mailing lists