]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: Fix possible corruption when moving a directory
authorJan Kara <jack@suse.cz>
Thu, 26 Jan 2023 11:22:21 +0000 (12:22 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Mar 2023 07:32:50 +0000 (08:32 +0100)
commitb251ff663d31ce0d4081089b8699e8f95c76478b
tree8ae763bea2c761783f2be8e2608d48698743fb46
parentdc1e9beac4a14d8bc55f6252bd3658ee7dde1de6
ext4: Fix possible corruption when moving a directory

[ Upstream commit 0813299c586b175d7edb25f56412c54b812d0379 ]

When we are renaming a directory to a different directory, we need to
update '..' entry in the moved directory. However nothing prevents moved
directory from being modified and even converted from the inline format
to the normal format. When such race happens the rename code gets
confused and we crash. Fix the problem by locking the moved directory.

CC: stable@vger.kernel.org
Fixes: 4f33f5947495 ("ext4: let ext4_rename handle inline dir")
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230126112221.11866-1-jack@suse.cz
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/ext4/namei.c