mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 00:53:34 +02:00
fs/ntfs3: Fix attr_insert_range at end of file
If the offset is equal to or greater than the end of file, an error is returned. For such operations (i.e., inserting a hole at the end of file), ftruncate(2) should be used. Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
This commit is contained in:
parent
0f9579d9e0
commit
519f38de57
|
|
@ -2373,8 +2373,13 @@ int attr_insert_range(struct ntfs_inode *ni, u64 vbo, u64 bytes)
|
|||
mask = (sbi->cluster_size << attr_b->nres.c_unit) - 1;
|
||||
}
|
||||
|
||||
if (vbo > data_size) {
|
||||
/* Insert range after the file size is not allowed. */
|
||||
if (vbo >= data_size) {
|
||||
/*
|
||||
* Insert range after the file size is not allowed.
|
||||
* If the offset is equal to or greater than the end of
|
||||
* file, an error is returned. For such operations (i.e., inserting
|
||||
* a hole at the end of file), ftruncate(2) should be used.
|
||||
*/
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user