Skip to content

Commit 801f614

Browse files
fs/ntfs3: fix mount failure for sparse runs in run_unpack()
Some NTFS volumes failed to mount because sparse data runs were not handled correctly during runlist unpacking. The code performed arithmetic on the special SPARSE_LCN64 marker, leading to invalid LCN values and mount errors. Add an explicit check for the case described above, marking the run as sparse without applying arithmetic. Fixes: 736fc7b ("fs: ntfs3: Fix integer overflow in run_unpack()") Cc: stable@vger.kernel.org Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
1 parent a846cd0 commit 801f614

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

fs/ntfs3/run.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -984,8 +984,12 @@ int run_unpack(struct runs_tree *run, struct ntfs_sb_info *sbi, CLST ino,
984984
if (!dlcn)
985985
return -EINVAL;
986986

987-
if (check_add_overflow(prev_lcn, dlcn, &lcn))
987+
/* Check special combination: 0 + SPARSE_LCN64. */
988+
if (!prev_lcn && dlcn == SPARSE_LCN64) {
989+
lcn = SPARSE_LCN64;
990+
} else if (check_add_overflow(prev_lcn, dlcn, &lcn)) {
988991
return -EINVAL;
992+
}
989993
prev_lcn = lcn;
990994
} else {
991995
/* The size of 'dlcn' can't be > 8. */

0 commit comments

Comments
 (0)