summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2023-01-23 16:29:15 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-17 10:45:07 +0300
commitfe80a53eabdb256a0610c7681ca8823435c963ac (patch)
tree43fa86d148edaf31a5ca5d16950069d079ad217d /fs
parent7786bfd8f7ab94f5c1ceb3e721aeccb76e24f414 (diff)
downloadlinux-fe80a53eabdb256a0610c7681ca8823435c963ac.tar.xz
udf: Fix off-by-one error when discarding preallocation
[ Upstream commit f54aa97fb7e5329a373f9df4e5e213ced4fc8759 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/udf/inode.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 81876284a83c..d114774ecdea 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -442,7 +442,7 @@ static int udf_get_block(struct inode *inode, sector_t block,
* Block beyond EOF and prealloc extents? Just discard preallocation
* as it is not useful and complicates things.
*/
- if (((loff_t)block) << inode->i_blkbits > iinfo->i_lenExtents)
+ if (((loff_t)block) << inode->i_blkbits >= iinfo->i_lenExtents)
udf_discard_prealloc(inode);
udf_clear_extent_cache(inode);
phys = inode_getblk(inode, block, &err, &new);