summaryrefslogtreecommitdiffstats
path: root/fs/ntfs3
diff options
context:
space:
mode:
authorKonstantin Komarov <almaz.alexandrovich@paragon-software.com>2023-11-24 12:17:46 +0300
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>2023-12-06 17:46:13 +0300
commite50f9560b8168a625703a3e7fe1fde9fa53f0837 (patch)
treefff9d512f9244e7d3730a3bc7fb46b4ecffaa08d /fs/ntfs3
parent4dea9cd522424d3002894c20b729c6fbfb6fc22b (diff)
downloadlinux-e50f9560b8168a625703a3e7fe1fde9fa53f0837.tar.gz
linux-e50f9560b8168a625703a3e7fe1fde9fa53f0837.tar.bz2
linux-e50f9560b8168a625703a3e7fe1fde9fa53f0837.zip
fs/ntfs3: Drop suid and sgid bits as a part of fpunch
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Diffstat (limited to 'fs/ntfs3')
-rw-r--r--fs/ntfs3/file.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
index bb80ce2eec2f..0ff5d3af2889 100644
--- a/fs/ntfs3/file.c
+++ b/fs/ntfs3/file.c
@@ -498,10 +498,14 @@ static long ntfs_fallocate(struct file *file, int mode, loff_t vbo, loff_t len)
ni_lock(ni);
err = attr_punch_hole(ni, vbo, len, &frame_size);
ni_unlock(ni);
+ if (!err)
+ goto ok;
+
if (err != E_NTFS_NOTALIGNED)
goto out;
/* Process not aligned punch. */
+ err = 0;
mask = frame_size - 1;
vbo_a = (vbo + mask) & ~mask;
end_a = end & ~mask;
@@ -524,6 +528,8 @@ static long ntfs_fallocate(struct file *file, int mode, loff_t vbo, loff_t len)
ni_lock(ni);
err = attr_punch_hole(ni, vbo_a, end_a - vbo_a, NULL);
ni_unlock(ni);
+ if (err)
+ goto out;
}
} else if (mode & FALLOC_FL_COLLAPSE_RANGE) {
/*
@@ -563,6 +569,8 @@ static long ntfs_fallocate(struct file *file, int mode, loff_t vbo, loff_t len)
ni_lock(ni);
err = attr_insert_range(ni, vbo, len);
ni_unlock(ni);
+ if (err)
+ goto out;
} else {
/* Check new size. */
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)
}
}
+ok:
err = file_modified(file);
if (err)
goto out;