]> git.baikalelectronics.ru Git - kernel.git/commit
udf: Fix extending file within last block
authorJan Kara <jack@suse.cz>
Thu, 8 Dec 2022 12:03:30 +0000 (13:03 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:40:47 +0000 (11:40 +0100)
commit5f6a6e42174e44dcfff26335843e208e33b0580b
treeb7f968f664886c9ba90f0484052d5fb92599b95d
parentcfca02c586c0be740cd29755eb6b8c75aafc6925
udf: Fix extending file within last block

commit a9cfa2bae782056d6a9eab6f977416760bd5b925 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/udf/inode.c