Skip to content

Commit a142323

Browse files
aalexandrovichaosemp
authored andcommitted
6.19: fs/ntfs3: Support timestamps prior to epoch
Before it used an unsigned 64-bit type, which prevented proper handling of timestamps earlier than 1970-01-01. Switch to a signed 64-bit type to support pre-epoch timestamps. The issue was caught by xfstests. Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> fs/ntfs3: Reformat code and update terminology Reformatted the driver code according to the current .clang-format rules and updated description of used terminology. No functional changes intended. Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> 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> ntfs: Do not kmap pages used for reading from disk These pages are accessed through DMA and vmap; they are not accessed by calling page_address(), so they do not need to be kmapped. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> ntfs: Do not kmap page cache pages for compression These pages are accessed through vmap; they are not accessed by calling page_address(), so they do not need to be kmapped. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> ntfs: Do not overwrite uptodate pages When reading a compressed file, we may read several pages in addition to the one requested. The current code will overwrite pages in the page cache with the data from disc which can definitely result in changes that have been made being lost. For example if we have four consecutie pages ABCD in the file compressed into a single extent, on first access, we'll bring in ABCD. Then we write to page B. Memory pressure results in the eviction of ACD. When we attempt to write to page C, we will overwrite the data in page B with the data currently on disk. I haven't investigated the decompression code to check whether it's OK to overwrite a clean page or whether it might be possible to see corrupt data. Out of an abundance of caution, decline to overwrite uptodate pages, not just dirty pages. Fixes: 4342306 (fs/ntfs3: Add file operations and implementation) Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: stable@vger.kernel.org Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> ntfs3: fix use-after-free of sbi->options in cmp_fnames The root cause is that sbi->options points directly to fc->fs_private. If fc->fs_private is freed while sbi still exists, sbi->options becomes a dangling pointer. This patch ensures that sbi->options is a separate copy of fc->fs_private and duplicates nls_name if present. On superblock release or error, sbi->options->nls_name and sbi->options are freed and sbi->options is set to NULL to avoid any dangling pointer. Reported-by: syzbot+d77c546c60db651a389c@syzkaller.appspotmail.com Signed-off-by: YangWen <anmuxixixi@gmail.com> [almaz.alexandrovich@paragon-software.com: remove syzbot logs from description] Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> ntfs3: fix uninit memory after failed mi_read in mi_format_new Fix a KMSAN un-init bug found by syzkaller. ntfs_get_bh() expects a buffer from sb_getblk(), that buffer may not be uptodate. We do not bring the buffer uptodate before setting it as uptodate. If the buffer were to not be uptodate, it could mean adding a buffer with un-init data to the mi record. Attempting to load that record will trigger KMSAN. Avoid this by setting the buffer as uptodate, if it’s not already, by overwriting it. Reported-by: syzbot+7a2ba6b7b66340cff225@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=7a2ba6b7b66340cff225 Tested-by: syzbot+7a2ba6b7b66340cff225@syzkaller.appspotmail.com Fixes: 4342306 ("fs/ntfs3: Add file operations and implementation") Signed-off-by: Raphael Pinsonneault-Thibeault <rpthibeault@gmail.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> ntfs3: Fix uninit buffer allocated by __getname() Fix uninit errors caused after buffer allocation given to 'de'; by initializing the buffer with zeroes. The fix was found by using KMSAN. Reported-by: syzbot+332bd4e9d148f11a87dc@syzkaller.appspotmail.com Fixes: 78ab59f ("fs/ntfs3: Rework file operations") Signed-off-by: Sidharth Seela <sidharthseela@gmail.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> fs/ntfs3: disable readahead for compressed files Reading large compressed files is extremely slow when readahead is enabled. For example, reading a 4 GB XPRESS-4K compressed file (compression ratio ≈ 4:1) takes about 230 minutes with readahead enabled, but only around 3 minutes when readahead is disabled. The issue was first observed in January 2025 and is reproducible with large compressed NTFS files. Disabling readahead for compressed files avoids this performance regression, although this may not be the ideal long-term fix. Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> ntfs: set dummy blocksize to read boot_block when mounting When mounting, sb->s_blocksize is used to read the boot_block without being defined or validated. Set a dummy blocksize before attempting to read the boot_block. The issue can be triggered with the following syz reproducer: mkdirat(0xffffffffffffff9c, &(0x7f0000000080)='./file1\x00', 0x0) r4 = openat$nullb(0xffffffffffffff9c, &(0x7f0000000040), 0x121403, 0x0) ioctl$FS_IOC_SETFLAGS(r4, 0x40081271, &(0x7f0000000980)=0x4000) mount(&(0x7f0000000140)=@nullb, &(0x7f0000000040)='./cgroup\x00', &(0x7f0000000000)='ntfs3\x00', 0x2208004, 0x0) syz_clone(0x88200200, 0x0, 0x0, 0x0, 0x0, 0x0) Here, the ioctl sets the bdev block size to 16384. During mount, get_tree_bdev_flags() calls sb_set_blocksize(sb, block_size(bdev)), but since block_size(bdev) > PAGE_SIZE, sb_set_blocksize() leaves sb->s_blocksize at zero. Later, ntfs_init_from_boot() attempts to read the boot_block while sb->s_blocksize is still zero, which triggers the bug. Reported-by: syzbot+f4f84b57a01d6b8364ad@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=f4f84b57a01d6b8364ad Signed-off-by: Pedro Demarchi Gomes <pedrodemargomes@gmail.com> [almaz.alexandrovich@paragon-software.com: changed comment style, added return value handling] Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> ntfs3: init run lock for extend inode After setting the inode mode of $Extend to a regular file, executing the truncate system call will enter the do_truncate() routine, causing the run_lock uninitialized error reported by syzbot. Prior to patch 4e8011f, if the inode mode of $Extend was not set to a regular file, the do_truncate() routine would not be entered. Add the run_lock initialization when loading $Extend. syzbot reported: INFO: trying to register non-static key. Call Trace: dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120 assign_lock_key+0x133/0x150 kernel/locking/lockdep.c:984 register_lock_class+0x105/0x320 kernel/locking/lockdep.c:1299 __lock_acquire+0x99/0xd20 kernel/locking/lockdep.c:5112 lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868 down_write+0x96/0x1f0 kernel/locking/rwsem.c:1590 ntfs_set_size+0x140/0x200 fs/ntfs3/inode.c:860 ntfs_extend+0x1d9/0x970 fs/ntfs3/file.c:387 ntfs_setattr+0x2e8/0xbe0 fs/ntfs3/file.c:808 Fixes: 4e8011f ("ntfs3: pretend $Extend records as regular files") Reported-by: syzbot+bdeb22a4b9a09ab9aa45@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=bdeb22a4b9a09ab9aa45 Tested-by: syzbot+bdeb22a4b9a09ab9aa45@syzkaller.appspotmail.com Signed-off-by: Edward Adam Davis <eadavis@qq.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> fs/ntfs3: fix KMSAN uninit-value in ni_create_attr_list The call to kmalloc() to allocate the attribute list buffer is given a size of al_aligned(rs). This size can be larger than the data subsequently copied into the buffer, leaving trailing bytes uninitialized. This can trigger a KMSAN "uninit-value" warning if that memory is later accessed. Fix this by using kzalloc() instead, which ensures the entire allocated buffer is zero-initialized, preventing the warning. Reported-by: syzbot+83c9dd5c0dcf6184fdbf@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=83c9dd5c0dcf6184fdbf Signed-off-by: Nirbhay Sharma <nirbhay.lkd@gmail.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> ntfs3: avoid memcpy size warning There are more entries after the structure, use unsafe_memcpy() to avoid this warning. syzbot reported: memcpy: detected field-spanning write (size 3656) of single field "hdr1" at fs/ntfs3/index.c:1927 (size 16) Call Trace: indx_insert_entry+0x1a0/0x460 fs/ntfs3/index.c:1996 ni_add_name+0x4dd/0x820 fs/ntfs3/frecord.c:2995 ni_rename+0x98/0x170 fs/ntfs3/frecord.c:3026 ntfs_rename+0xab9/0xf00 fs/ntfs3/namei.c:332 Reported-by: syzbot+3a1878433bc1cb97b42a@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3a1878433bc1cb97b42a Signed-off-by: Lizhi Xu <lizhi.xu@windriver.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> fs/ntfs3: remove ntfs_bio_pages and use page cache for compressed I/O Replace the use of ntfs_bio_pages with the disk page cache for reading and writing compressed files. This slightly improves performance when reading compressed data and simplifies the I/O logic. When an XPRESS or LZX compressed file is opened for writing, it is now decompressed into a normal file before modification. A new argument (`int copy`) is added to ni_read_frame() to handle writing of decompressed and mapped data. Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> fs/ntfs3: Initialize allocated memory before use KMSAN reports: Multiple uninitialized values detected: - KMSAN: uninit-value in ntfs_read_hdr (3) - KMSAN: uninit-value in bcmp (3) Memory is allocated by __getname(), which is a wrapper for kmem_cache_alloc(). This memory is used before being properly cleared. Change kmem_cache_alloc() to kmem_cache_zalloc() to properly allocate and clear memory before use. Fixes: 82cae26 ("fs/ntfs3: Add initialization of super block") Fixes: 78ab59f ("fs/ntfs3: Rework file operations") Tested-by: syzbot+332bd4e9d148f11a87dc@syzkaller.appspotmail.com Reported-by: syzbot+332bd4e9d148f11a87dc@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=332bd4e9d148f11a87dc Fixes: 82cae26 ("fs/ntfs3: Add initialization of super block") Fixes: 78ab59f ("fs/ntfs3: Rework file operations") Tested-by: syzbot+0399100e525dd9696764@syzkaller.appspotmail.com Reported-by: syzbot+0399100e525dd9696764@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=0399100e525dd9696764 Reviewed-by: Khalid Aziz <khalid@kernel.org> Signed-off-by: Bartlomiej Kubik <kubik.bartlomiej@gmail.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> ntfs3: fix double free of sbi->options->nls and clarify ownership of fc->fs_private commit 02f3127 ("ntfs3: fix use-after-free of sbi->options in cmp_fnames") introduced a use-after-free bug due to improper handling of sbi->options in error paths. This resulted in crashes when superblock cleanup is performed in ntfs_put_super. This patch ensures that the options structure and its subfields are properly freed, preventing the memory corruption and use-after-free errors. Fixes: 02f3127 ("ntfs3: fix use-after-free of sbi->options in cmp_fnames") Reported-by: syzbot+cc433e4cd6d54736bf80@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=cc433e4cd6d54736bf80 Signed-off-by: YangWen <anmuxixixi@gmail.com> [almaz.alexandrovich@paragon-software.com: added fixes and closes tags] Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> fs/ntfs3: correct attr_collapse_range when file is too fragmented Fix incorrect VCN adjustments in attr_collapse_range() that caused filesystem errors or corruption on very fragmented NTFS files when performing collapse-range operations. Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> fs/ntfs3: implement NTFS3_IOC_SHUTDOWN ioctl Add support for the NTFS3_IOC_SHUTDOWN ioctl, allowing userspace to request a filesystem shutdown. The ioctl number is shared with other filesystems such as ext4, exfat, and f2fs. Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> fs/ntfs3: check minimum alignment for direct I/O Add a check for minimum alignment when performing direct I/O reads. If the file offset or user buffer is not aligned to the device's logical block size, fall back to buffered I/O instead of continuing with unaligned direct I/O. Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> fs/ntfs3: update mode in xattr when ACL can be reduced to mode If a file's ACL can be reduced to standard mode bits, update mode accordingly, persist the change, and update the cached ACL. This keeps mode and ACL consistent and avoids redundant xattrs. Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> fs/ntfs3: Fix spelling mistake "recommened" -> "recommended" There is a spelling mistake in a ntfs_info message. Fix it. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> fs/ntfs3: out1 also needs to put mi After ntfs_look_free_mft() executes successfully, all subsequent code that fails to execute must put mi. Fixes: 4342306 ("fs/ntfs3: Add file operations and implementation") Signed-off-by: Edward Adam Davis <eadavis@qq.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> fs/ntfs3: Prevent memory leaks in add sub record If a rb node with the same ino already exists in the rb tree, the newly alloced mft_inode in ni_add_subrecord() will not have its memory cleaned up, which leads to the memory leak issue reported by syzbot. The best option to avoid this issue is to put the newly alloced mft node when a rb node with the same ino already exists in the rb tree and return the rb node found in the rb tree to the parent layer. syzbot reported: BUG: memory leak unreferenced object 0xffff888110bef280 (size 128): backtrace (crc 126a088f): ni_add_subrecord+0x31/0x180 fs/ntfs3/frecord.c:317 ntfs_look_free_mft+0xf0/0x790 fs/ntfs3/fsntfs.c:715 BUG: memory leak unreferenced object 0xffff888109093400 (size 1024): backtrace (crc 7197c55e): mi_init+0x2b/0x50 fs/ntfs3/record.c:105 mi_format_new+0x40/0x220 fs/ntfs3/record.c:422 Fixes: 4342306 ("fs/ntfs3: Add file operations and implementation") Reported-by: syzbot+3932ccb896e06f7414c9@syzkaller.appspotmail.com Signed-off-by: Edward Adam Davis <eadavis@qq.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> fs/ntfs3: change the default mount options for "acl" and "prealloc" Switch the "acl" and "prealloc" mount parameters to fsparam_flag_no(), making them enabled by default and allowing users to disable them with "noacl" and "noprealloc". Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> fs/ntfs3: check for shutdown in fsync Ensure fsync() returns -EIO when the ntfs3 filesystem is in forced shutdown, instead of silently succeeding via generic_file_fsync(). Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
1 parent 086c46b commit a142323

File tree

13 files changed

+421
-331
lines changed

13 files changed

+421
-331
lines changed

fs/ntfs3/attrib.c

Lines changed: 42 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,7 +1457,6 @@ int attr_wof_frame_info(struct ntfs_inode *ni, struct ATTRIB *attr,
14571457
pgoff_t index = vbo[i] >> PAGE_SHIFT;
14581458

14591459
if (index != folio->index) {
1460-
struct page *page = &folio->page;
14611460
u64 from = vbo[i] & ~(u64)(PAGE_SIZE - 1);
14621461
u64 to = min(from + PAGE_SIZE, wof_size);
14631462

@@ -1467,8 +1466,7 @@ int attr_wof_frame_info(struct ntfs_inode *ni, struct ATTRIB *attr,
14671466
if (err)
14681467
goto out1;
14691468

1470-
err = ntfs_bio_pages(sbi, run, &page, 1, from,
1471-
to - from, REQ_OP_READ);
1469+
err = ntfs_read_run(sbi, run, addr, from, to - from);
14721470
if (err) {
14731471
folio->index = -1;
14741472
goto out1;
@@ -1862,7 +1860,7 @@ int attr_collapse_range(struct ntfs_inode *ni, u64 vbo, u64 bytes)
18621860
struct ATTRIB *attr = NULL, *attr_b;
18631861
struct ATTR_LIST_ENTRY *le, *le_b;
18641862
struct mft_inode *mi, *mi_b;
1865-
CLST svcn, evcn1, len, dealloc, alen;
1863+
CLST svcn, evcn1, len, dealloc, alen, done;
18661864
CLST vcn, end;
18671865
u64 valid_size, data_size, alloc_size, total_size;
18681866
u32 mask;
@@ -1925,6 +1923,7 @@ int attr_collapse_range(struct ntfs_inode *ni, u64 vbo, u64 bytes)
19251923
len = bytes >> sbi->cluster_bits;
19261924
end = vcn + len;
19271925
dealloc = 0;
1926+
done = 0;
19281927

19291928
svcn = le64_to_cpu(attr_b->nres.svcn);
19301929
evcn1 = le64_to_cpu(attr_b->nres.evcn) + 1;
@@ -1933,23 +1932,28 @@ int attr_collapse_range(struct ntfs_inode *ni, u64 vbo, u64 bytes)
19331932
attr = attr_b;
19341933
le = le_b;
19351934
mi = mi_b;
1936-
} else if (!le_b) {
1935+
goto check_seg;
1936+
}
1937+
1938+
if (!le_b) {
19371939
err = -EINVAL;
19381940
goto out;
1939-
} else {
1940-
le = le_b;
1941-
attr = ni_find_attr(ni, attr_b, &le, ATTR_DATA, NULL, 0, &vcn,
1942-
&mi);
1943-
if (!attr) {
1944-
err = -EINVAL;
1945-
goto out;
1946-
}
1941+
}
19471942

1948-
svcn = le64_to_cpu(attr->nres.svcn);
1949-
evcn1 = le64_to_cpu(attr->nres.evcn) + 1;
1943+
le = le_b;
1944+
attr = ni_find_attr(ni, attr_b, &le, ATTR_DATA, NULL, 0, &vcn, &mi);
1945+
if (!attr) {
1946+
err = -EINVAL;
1947+
goto out;
19501948
}
19511949

19521950
for (;;) {
1951+
CLST vcn1, eat, next_svcn;
1952+
1953+
svcn = le64_to_cpu(attr->nres.svcn);
1954+
evcn1 = le64_to_cpu(attr->nres.evcn) + 1;
1955+
1956+
check_seg:
19531957
if (svcn >= end) {
19541958
/* Shift VCN- */
19551959
attr->nres.svcn = cpu_to_le64(svcn - len);
@@ -1959,30 +1963,33 @@ int attr_collapse_range(struct ntfs_inode *ni, u64 vbo, u64 bytes)
19591963
ni->attr_list.dirty = true;
19601964
}
19611965
mi->dirty = true;
1962-
} else if (svcn < vcn || end < evcn1) {
1963-
CLST vcn1, eat, next_svcn;
1966+
goto next_attr;
1967+
}
19641968

1965-
/* Collapse a part of this attribute segment. */
1966-
err = attr_load_runs(attr, ni, run, &svcn);
1967-
if (err)
1968-
goto out;
1969-
vcn1 = max(vcn, svcn);
1970-
eat = min(end, evcn1) - vcn1;
1969+
run_truncate(run, 0);
1970+
err = attr_load_runs(attr, ni, run, &svcn);
1971+
if (err)
1972+
goto out;
19711973

1972-
err = run_deallocate_ex(sbi, run, vcn1, eat, &dealloc,
1973-
true);
1974-
if (err)
1975-
goto out;
1974+
vcn1 = vcn + done; /* original vcn in attr/run. */
1975+
eat = min(end, evcn1) - vcn1;
1976+
1977+
err = run_deallocate_ex(sbi, run, vcn1, eat, &dealloc, true);
1978+
if (err)
1979+
goto out;
19761980

1977-
if (!run_collapse_range(run, vcn1, eat)) {
1981+
if (svcn + eat < evcn1) {
1982+
/* Collapse a part of this attribute segment. */
1983+
1984+
if (!run_collapse_range(run, vcn1, eat, done)) {
19781985
err = -ENOMEM;
19791986
goto out;
19801987
}
19811988

19821989
if (svcn >= vcn) {
19831990
/* Shift VCN */
19841991
attr->nres.svcn = cpu_to_le64(vcn);
1985-
if (le) {
1992+
if (le && attr->nres.svcn != le->vcn) {
19861993
le->vcn = attr->nres.svcn;
19871994
ni->attr_list.dirty = true;
19881995
}
@@ -1993,7 +2000,7 @@ int attr_collapse_range(struct ntfs_inode *ni, u64 vbo, u64 bytes)
19932000
goto out;
19942001

19952002
next_svcn = le64_to_cpu(attr->nres.evcn) + 1;
1996-
if (next_svcn + eat < evcn1) {
2003+
if (next_svcn + eat + done < evcn1) {
19972004
err = ni_insert_nonresident(
19982005
ni, ATTR_DATA, NULL, 0, run, next_svcn,
19992006
evcn1 - eat - next_svcn, a_flags, &attr,
@@ -2007,18 +2014,9 @@ int attr_collapse_range(struct ntfs_inode *ni, u64 vbo, u64 bytes)
20072014

20082015
/* Free all allocated memory. */
20092016
run_truncate(run, 0);
2017+
done += eat;
20102018
} else {
20112019
u16 le_sz;
2012-
u16 roff = le16_to_cpu(attr->nres.run_off);
2013-
2014-
if (roff > le32_to_cpu(attr->size)) {
2015-
err = -EINVAL;
2016-
goto out;
2017-
}
2018-
2019-
run_unpack_ex(RUN_DEALLOCATE, sbi, ni->mi.rno, svcn,
2020-
evcn1 - 1, svcn, Add2Ptr(attr, roff),
2021-
le32_to_cpu(attr->size) - roff);
20222020

20232021
/* Delete this attribute segment. */
20242022
mi_remove_attr(NULL, mi, attr);
@@ -2031,6 +2029,7 @@ int attr_collapse_range(struct ntfs_inode *ni, u64 vbo, u64 bytes)
20312029
goto out;
20322030
}
20332031

2032+
done += evcn1 - svcn;
20342033
if (evcn1 >= alen)
20352034
break;
20362035

@@ -2048,11 +2047,12 @@ int attr_collapse_range(struct ntfs_inode *ni, u64 vbo, u64 bytes)
20482047
err = -EINVAL;
20492048
goto out;
20502049
}
2051-
goto next_attr;
2050+
continue;
20522051
}
20532052
le = (struct ATTR_LIST_ENTRY *)((u8 *)le - le_sz);
20542053
}
20552054

2055+
next_attr:
20562056
if (evcn1 >= alen)
20572057
break;
20582058

@@ -2061,10 +2061,6 @@ int attr_collapse_range(struct ntfs_inode *ni, u64 vbo, u64 bytes)
20612061
err = -EINVAL;
20622062
goto out;
20632063
}
2064-
2065-
next_attr:
2066-
svcn = le64_to_cpu(attr->nres.svcn);
2067-
evcn1 = le64_to_cpu(attr->nres.evcn) + 1;
20682064
}
20692065

20702066
if (!attr_b) {
@@ -2554,7 +2550,7 @@ int attr_insert_range(struct ntfs_inode *ni, u64 vbo, u64 bytes)
25542550
if (attr_load_runs(attr, ni, run, NULL))
25552551
goto bad_inode;
25562552

2557-
if (!run_collapse_range(run, vcn, len))
2553+
if (!run_collapse_range(run, vcn, len, 0))
25582554
goto bad_inode;
25592555

25602556
if (mi_pack_runs(mi, attr, run, evcn1 + len - svcn))

fs/ntfs3/dir.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,7 @@ static inline bool ntfs_dir_emit(struct ntfs_sb_info *sbi,
332332
* It does additional locks/reads just to get the type of name.
333333
* Should we use additional mount option to enable branch below?
334334
*/
335-
if (fname->dup.extend_data &&
336-
ino != ni->mi.rno) {
335+
if (fname->dup.extend_data && ino != ni->mi.rno) {
337336
struct inode *inode = ntfs_iget5(sbi->sb, &e->ref, NULL);
338337
if (!IS_ERR_OR_NULL(inode)) {
339338
dt_type = fs_umode_to_dtype(inode->i_mode);

0 commit comments

Comments
 (0)