Skip to content

Commit e50f956

Browse files
fs/ntfs3: Drop suid and sgid bits as a part of fpunch
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
1 parent 4dea9cd commit e50f956

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

fs/ntfs3/file.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,10 +498,14 @@ static long ntfs_fallocate(struct file *file, int mode, loff_t vbo, loff_t len)
498498
ni_lock(ni);
499499
err = attr_punch_hole(ni, vbo, len, &frame_size);
500500
ni_unlock(ni);
501+
if (!err)
502+
goto ok;
503+
501504
if (err != E_NTFS_NOTALIGNED)
502505
goto out;
503506

504507
/* Process not aligned punch. */
508+
err = 0;
505509
mask = frame_size - 1;
506510
vbo_a = (vbo + mask) & ~mask;
507511
end_a = end & ~mask;
@@ -524,6 +528,8 @@ static long ntfs_fallocate(struct file *file, int mode, loff_t vbo, loff_t len)
524528
ni_lock(ni);
525529
err = attr_punch_hole(ni, vbo_a, end_a - vbo_a, NULL);
526530
ni_unlock(ni);
531+
if (err)
532+
goto out;
527533
}
528534
} else if (mode & FALLOC_FL_COLLAPSE_RANGE) {
529535
/*
@@ -563,6 +569,8 @@ static long ntfs_fallocate(struct file *file, int mode, loff_t vbo, loff_t len)
563569
ni_lock(ni);
564570
err = attr_insert_range(ni, vbo, len);
565571
ni_unlock(ni);
572+
if (err)
573+
goto out;
566574
} else {
567575
/* Check new size. */
568576
u8 cluster_bits = sbi->cluster_bits;
@@ -639,6 +647,7 @@ static long ntfs_fallocate(struct file *file, int mode, loff_t vbo, loff_t len)
639647
}
640648
}
641649

650+
ok:
642651
err = file_modified(file);
643652
if (err)
644653
goto out;

0 commit comments

Comments
 (0)