From: Theodore Ts'o Date: Sat, 18 Mar 2023 01:53:52 +0000 (-0400) Subject: ext4: fix possible double unlock when moving a directory X-Git-Tag: baikal/mips/sdk6.1~87 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=9ed87718876b303ed074d8ab25eef1d88fd825e5;p=kernel.git ext4: fix possible double unlock when moving a directory commit ae7f28a94c8fca8514e031ba80fb5c6161e730b2 upstream. Fixes: 9561e8b4f5bb ("ext4: Fix possible corruption when moving a directory") Link: https://lore.kernel.org/r/5efbe1b9-ad8b-4a4f-b422-24824d2b775c@kili.mountain Reported-by: Dan Carpenter Reported-by: syzbot+0c73d1d8b952c5f3d714@syzkaller.appspotmail.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 800d631c920b4..56f09598448b4 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -3884,10 +3884,8 @@ static int ext4_rename(struct user_namespace *mnt_userns, struct inode *old_dir, goto end_rename; } retval = ext4_rename_dir_prepare(handle, &old); - if (retval) { - inode_unlock(old.inode); + if (retval) goto end_rename; - } } /* * If we're renaming a file within an inline_data dir and adding or