Fixed the locking bug with the bisection found by syzbot. Link to the syzbot bug report: https://syzkaller.appspot.com/bug?extid=a3c8e9ac9f9d77240afd Reported-by: syzbot+a3c8e9ac9f9d77240afd@xxxxxxxxxxxxxxxxxxxxxxxxx Signed-off-by: Remington Brasga <rbrasga@xxxxxxx> --- First attempt at patching this issue. Verified the bug exists, and that this patch fixes it, and EXT4 KUnit tests pass. Though I am not sure if the patch should be higher up the stack. Open to questions or any suggestions for improvements. #syz test fs/ext4/xattr.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index e0e1956dcdd3..2b30b9571fd8 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -124,8 +124,12 @@ void ext4_xattr_inode_set_class(struct inode *ea_inode) struct ext4_inode_info *ei = EXT4_I(ea_inode); lockdep_set_subclass(&ea_inode->i_rwsem, 1); - (void) ei; /* shut up clang warning if !CONFIG_LOCKDEP */ - lockdep_set_subclass(&ei->i_data_sem, I_DATA_SEM_EA); + + if (ei->i_flags & EXT4_EA_INODE_FL) { + lockdep_set_subclass(&ei->i_data_sem, I_DATA_SEM_EA); + } else { + lockdep_set_subclass(&ei->i_data_sem, I_DATA_SEM_NORMAL); + } } #endif -- 2.34.1