Files
twx-linux/fs
Jan Kara 5d6cc0541e 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-10 09:29:32 +01:00
..
2023-01-31 16:44:08 -08:00
2022-12-11 18:12:18 -08:00
2023-03-10 09:28:46 +01:00
2023-03-10 09:28:40 +01:00
2022-12-11 18:12:18 -08:00
2023-03-10 09:28:46 +01:00
2023-01-05 07:34:21 -08:00
2023-02-03 17:52:24 -08:00
2022-12-21 14:45:25 +01:00