From: syzbot <syzbot+7a2ba6b7b66340cff225@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] possible fix (linux-ntfs3)
Date: Tue, 10 Sep 2024 00:14:30 -0700 [thread overview]
Message-ID: <000000000000ea89ee0621be9fc5@google.com> (raw)
In-Reply-To: <000000000000b3424a062114aaa3@google.com>
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: possible fix (linux-ntfs3)
Author: almaz.alexandrovich@paragon-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;
next prev parent reply other threads:[~2024-09-10 7:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-01 20:28 [syzbot] [ntfs3?] KMSAN: uninit-value in ntfs_read_bh syzbot
2024-09-04 15:47 ` syzbot
2024-09-10 7:14 ` syzbot [this message]
2025-09-25 16:59 ` Forwarded: potential fix syzbot
2025-10-12 18:36 ` Forwarded: test fix syzbot
-- strict thread matches above, loose matches on Subject: below --
2024-09-04 1:15 [syzbot] [ntfs3?] INFO: trying to register non-static key in mark_as_free_ex syzbot
2024-09-09 15:13 ` [syzbot] possible fix (linux-ntfs3) syzbot
2024-08-16 13:07 [syzbot] [ntfs3?] kernel panic: stack is corrupted in vprintk_emit syzbot
2024-09-02 12:27 ` [syzbot] possible fix (linux-ntfs3) syzbot
2024-09-10 7:08 ` syzbot
2024-07-13 6:10 [syzbot] [ntfs3?] general protection fault in run_is_mapped_full syzbot
2024-09-02 13:00 ` [syzbot] possible fix (linux-ntfs3) syzbot
2022-10-01 13:47 [syzbot] possible deadlock in mi_read syzbot
2024-09-02 13:17 ` [syzbot] possible fix (linux-ntfs3) syzbot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=000000000000ea89ee0621be9fc5@google.com \
--to=syzbot+7a2ba6b7b66340cff225@syzkaller.appspotmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzkaller-bugs@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.