Commit e50f9560 authored by Konstantin Komarov's avatar Konstantin Komarov

fs/ntfs3: Drop suid and sgid bits as a part of fpunch

Signed-off-by: default avatarKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
parent 4dea9cd5
...@@ -498,10 +498,14 @@ static long ntfs_fallocate(struct file *file, int mode, loff_t vbo, loff_t len) ...@@ -498,10 +498,14 @@ static long ntfs_fallocate(struct file *file, int mode, loff_t vbo, loff_t len)
ni_lock(ni); ni_lock(ni);
err = attr_punch_hole(ni, vbo, len, &frame_size); err = attr_punch_hole(ni, vbo, len, &frame_size);
ni_unlock(ni); ni_unlock(ni);
if (!err)
goto ok;
if (err != E_NTFS_NOTALIGNED) if (err != E_NTFS_NOTALIGNED)
goto out; goto out;
/* Process not aligned punch. */ /* Process not aligned punch. */
err = 0;
mask = frame_size - 1; mask = frame_size - 1;
vbo_a = (vbo + mask) & ~mask; vbo_a = (vbo + mask) & ~mask;
end_a = end & ~mask; end_a = end & ~mask;
...@@ -524,6 +528,8 @@ static long ntfs_fallocate(struct file *file, int mode, loff_t vbo, loff_t len) ...@@ -524,6 +528,8 @@ static long ntfs_fallocate(struct file *file, int mode, loff_t vbo, loff_t len)
ni_lock(ni); ni_lock(ni);
err = attr_punch_hole(ni, vbo_a, end_a - vbo_a, NULL); err = attr_punch_hole(ni, vbo_a, end_a - vbo_a, NULL);
ni_unlock(ni); ni_unlock(ni);
if (err)
goto out;
} }
} else if (mode & FALLOC_FL_COLLAPSE_RANGE) { } 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) ...@@ -563,6 +569,8 @@ static long ntfs_fallocate(struct file *file, int mode, loff_t vbo, loff_t len)
ni_lock(ni); ni_lock(ni);
err = attr_insert_range(ni, vbo, len); err = attr_insert_range(ni, vbo, len);
ni_unlock(ni); ni_unlock(ni);
if (err)
goto out;
} else { } else {
/* Check new size. */ /* Check new size. */
u8 cluster_bits = sbi->cluster_bits; 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) ...@@ -639,6 +647,7 @@ static long ntfs_fallocate(struct file *file, int mode, loff_t vbo, loff_t len)
} }
} }
ok:
err = file_modified(file); err = file_modified(file);
if (err) if (err)
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment