diff options
author | Jan Kara <jack@suse.cz> | 2023-01-23 16:29:15 +0300 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2023-01-26 18:46:35 +0300 |
commit | f54aa97fb7e5329a373f9df4e5e213ced4fc8759 (patch) | |
tree | f2e7fd25749f236375d633e9e3bacb815422d166 | |
parent | 36ec52ea038b18a53e198116ef7d7e70c87db046 (diff) | |
download | linux-f54aa97fb7e5329a373f9df4e5e213ced4fc8759.tar.xz |
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>
-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); |