ext4: make sure to reset inode lockdep class when quota enabling fails
authorJan Kara <jack@suse.cz>
Thu, 7 Oct 2021 15:53:36 +0000 (17:53 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 10:05:15 +0000 (11:05 +0100)
commit8ffe9ad9f5efc14a0d7a706ba3b8ee616b682872
treeb714d9253487c1d3713516a909496ee3e4072e0a
parent5237c93d58c3723e99a03f2d3305145d67dfebe0
ext4: make sure to reset inode lockdep class when quota enabling fails

commit 4013d47a5307fdb5c13370b5392498b00fedd274 upstream.

When we succeed in enabling some quota type but fail to enable another
one with quota feature, we correctly disable all enabled quota types.
However we forget to reset i_data_sem lockdep class. When the inode gets
freed and reused, it will inherit this lockdep class (i_data_sem is
initialized only when a slab is created) and thus eventually lockdep
barfs about possible deadlocks.

Reported-and-tested-by: syzbot+3b6f9218b1301ddda3e2@syzkaller.appspotmail.com
Signed-off-by: Jan Kara <jack@suse.cz>
Cc: stable@kernel.org
Link: https://lore.kernel.org/r/20211007155336.12493-3-jack@suse.cz
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/super.c