diff options
author | Jan Kara <jack@suse.cz> | 2023-01-23 14:29:15 +0100 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2023-01-26 16:46:35 +0100 |
commit | f54aa97fb7e5329a373f9df4e5e213ced4fc8759 (patch) | |
tree | f2e7fd25749f236375d633e9e3bacb815422d166 /fs/udf | |
parent | udf: Fix file corruption when appending just after end of preallocated extent (diff) | |
download | linux-f54aa97fb7e5329a373f9df4e5e213ced4fc8759.tar.xz linux-f54aa97fb7e5329a373f9df4e5e213ced4fc8759.zip |
udf: Fix off-by-one error when discarding preallocation
The condition determining whether the preallocation can be used had
an off-by-one error so we didn't discard preallocation when new
allocation was just following it. This can then confuse code in
inode_getblk().
CC: stable@vger.kernel.org
Fixes: 16d055656814 ("udf: Discard preallocation before extending file with a hole")
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/udf')
-rw-r--r-- | fs/udf/inode.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 51deada8b928..ee440d16411e 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c @@ -361,7 +361,7 @@ static int udf_map_block(struct inode *inode, struct udf_map_rq *map) * Block beyond EOF and prealloc extents? Just discard preallocation * as it is not useful and complicates things. */ - if (((loff_t)map->lblk) << inode->i_blkbits > iinfo->i_lenExtents) + if (((loff_t)map->lblk) << inode->i_blkbits >= iinfo->i_lenExtents) udf_discard_prealloc(inode); udf_clear_extent_cache(inode); err = inode_getblk(inode, map); |