Skip to content

Commit

Permalink
fs/ntfs3: Drop suid and sgid bits as a part of fpunch
Browse files Browse the repository at this point in the history
[ Upstream commit e50f956 ]

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
aalexandrovich authored and gregkh committed Mar 1, 2024
1 parent c28efa8 commit 7e0aff0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions fs/ntfs3/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
/*
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 7e0aff0

Please sign in to comment.