udf: Fix extending file within last block
authorJan Kara <jack@suse.cz>
Thu, 8 Dec 2022 12:03:30 +0000 (13:03 +0100)
committerJan Kara <jack@suse.cz>
Fri, 9 Dec 2022 11:37:26 +0000 (12:37 +0100)
commit1f3868f06855c97a4954c99b36f3fc9eb8f60326
treed0bf1373ee6b1fa547219b2f5a066b34d0564ea0
parent16d0556568148bdcaa45d077cac9f8f7077cf70a
udf: Fix extending file within last block

When extending file within last block it can happen that the extent is
already rounded to the blocksize and thus contains the offset we want to
grow up to. In such case we would mistakenly expand the last extent and
make it one block longer than it should be, exposing unallocated block
in a file and causing data corruption. Fix the problem by properly
detecting this case and bailing out.

CC: stable@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
fs/udf/inode.c