]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: make sure ext4_append() always allocates new block
authorLukas Czerner <lczerner@redhat.com>
Mon, 4 Jul 2022 14:27:21 +0000 (16:27 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:24:27 +0000 (14:24 +0200)
commit33ca97c499a85de17332e87ee319ea333d3f1242
treeef4779c29c5ea3ca01860c9b52506df2c9ef932c
parenta8bd18be975700daa501e494f8ff80e6107435c9
ext4: make sure ext4_append() always allocates new block

[ Upstream commit a90538b291354cef1250ba4b4d5db03fa5f204e8 ]

ext4_append() must always allocate a new block, otherwise we run the
risk of overwriting existing directory block corrupting the directory
tree in the process resulting in all manner of problems later on.

Add a sanity check to see if the logical block is already allocated and
error out if it is.

Cc: stable@kernel.org
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Link: https://lore.kernel.org/r/20220704142721.157985-2-lczerner@redhat.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/ext4/namei.c