]> git.ipfire.org Git - thirdparty/linux.git/commit
ext4: Fix deadlock during directory rename
authorJan Kara <jack@suse.cz>
Wed, 1 Mar 2023 14:10:04 +0000 (15:10 +0100)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 8 Mar 2023 02:45:38 +0000 (21:45 -0500)
commit3c92792da8506a295afb6d032b4476e46f979725
tree92613efa0c13d22c51e0f24709db7e9409f8e0e4
parent7fc1f5c28ae4c615ccc5346f39a7bf4c4e0900ac
ext4: Fix deadlock during directory rename

As lockdep properly warns, we should not be locking i_rwsem while having
transactions started as the proper lock ordering used by all directory
handling operations is i_rwsem -> transaction start. Fix the lock
ordering by moving the locking of the directory earlier in
ext4_rename().

Reported-by: syzbot+9d16c39efb5fade84574@syzkaller.appspotmail.com
Fixes: 0813299c586b ("ext4: Fix possible corruption when moving a directory")
Link: https://syzkaller.appspot.com/bug?extid=9d16c39efb5fade84574
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230301141004.15087-1-jack@suse.cz
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/namei.c