linux-stable/fs/udf
Jan Kara 38a1f5e9fc udf: Fix file corruption when appending just after end of preallocated extent
commit 36ec52ea03 upstream.

When we append new block just after the end of preallocated extent, the
code in inode_getblk() wrongly determined we're going to use the
preallocated extent which resulted in adding block into a wrong logical
offset in the file. Sequence like this manifests it:

xfs_io -f -c "pwrite 0x2cacf 0xd122" -c "truncate 0x2dd6f" \
  -c "pwrite 0x27fd9 0x69a9" -c "pwrite 0x32981 0x7244" <file>

The code that determined the use of preallocated extent is actually
stale because udf_do_extend_file() does not create preallocation anymore
so after calling that function we are sure there's no usable
preallocation. Just remove the faulty condition.

CC: stable@vger.kernel.org
Fixes: 16d0556568 ("udf: Discard preallocation before extending file with a hole")
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-11 16:44:01 +01:00
..
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
balloc.c udf: prevent allocation beyond UDF partition 2019-07-31 18:41:37 +02:00
dir.c udf: Fix crash after seekdir 2021-11-26 10:47:21 +01:00
directory.c udf: Provide function for calculating dir entry length 2018-06-20 11:05:49 +02:00
ecma_167.h udf: Verify domain identifier fields 2019-09-04 18:19:25 +02:00
file.c udf: Do not update file length for failed writes to inline files 2023-03-11 16:44:00 +01:00
ialloc.c udf: augment UDF permissions on new inodes 2019-08-27 15:38:46 +02:00
inode.c udf: Fix file corruption when appending just after end of preallocated extent 2023-03-11 16:44:01 +01:00
lowlevel.c
misc.c udf_get_extendedattr() had no boundary checks. 2021-09-15 09:47:28 +02:00
namei.c udf: Avoid double brelse() in udf_rename() 2023-01-18 11:41:34 +01:00
osta_udf.h
partition.c
super.c udf: Preserve link count of system files 2023-03-11 16:44:00 +01:00
symlink.c
truncate.c udf: Do not bother looking for prealloc extents if i_lenExtents matches i_size 2023-01-18 11:40:47 +01:00
udf_i.h udf: Preserve link count of system files 2023-03-11 16:44:00 +01:00
udf_sb.h udf: Define EFSCORRUPTED error code 2023-03-11 16:43:53 +01:00
udfdecl.h udf: augment UDF permissions on new inodes 2019-08-27 15:38:46 +02:00
udfend.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
udftime.c udf: convert inode stamps to timespec64 2018-06-27 13:58:00 +02:00
unicode.c udf: Fix iocharset=utf8 mount option 2021-09-15 09:47:27 +02:00