diff options
| author | Wahid Khan <wahidzk0091@gmail.com> | 2026-11-06 18:15:51 +0530 |
|---|---|---|
| committer | Namjae Jeon <linkinjeon@kernel.org> | 2026-11-08 12:43:06 +0900 |
| commit | 0ea30dd6eeabc09235d5c2cdb98ca4e0d593963f (patch) | |
| tree | 3078e70edb5590dbb45cb44ad76b2f7365965c00 /scripts/Makefile.thinlto | |
| parent | ce5cdda498a9479b32ba1c7d68b1d97f3c840354 (diff) | |
| download | lwn-0ea30dd6eeabc09235d5c2cdb98ca4e0d593963f.tar.gz lwn-0ea30dd6eeabc09235d5c2cdb98ca4e0d593963f.zip | |
ntfs: do not read an index block outside $INDEX_ALLOCATION
A directory whose $INDEX_ROOT has a child node but whose
$INDEX_ALLOCATION is missing or damaged gets an empty index inode from
ntfs_read_locked_index_inode(): size 0 and not non-resident.
ntfs_lookup_inode_by_name() still follows the child node and reads a
folio from that inode while it holds the mft record lock of the
directory.
Since the resident iomap read started to take base_ni->mrec_lock, that
read waits for a lock the caller already holds:
INFO: task init:1 is blocked on a mutex likely owned by task init:1.
__mutex_lock
__ntfs_read_iomap_begin
ntfs_read_iomap_next
iomap_read_folio
ntfs_read_folio
ntfs_lookup_inode_by_name
ntfs_lookup
The task never returns, and neither does anything else that needs the
directory's mft record.
It takes one corrupted byte on an image from mkntfs: change the first
byte of the type of the $INDEX_ALLOCATION attribute header of a
directory with index blocks from 0xa0 to 0x00. The first lookup in that
directory hangs.
Check that the index inode is non-resident and that the vcn lies inside
it before every index block read, and fail with -EIO otherwise. This
also rejects a negative vcn, which was only checked on later descents.
Fixes: d9e00c457d4a ("ntfs: serialize resident iomap reads with mrec_lock")
Cc: stable@vger.kernel.org # v7.3+
Signed-off-by: Wahid Khan <wahidzk0091@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
