]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: check and assert if marking an no_delete evicting inode dirty
authorZhang Yi <yi.zhang@huawei.com>
Wed, 29 Jun 2022 11:26:47 +0000 (19:26 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 7 Jan 2023 10:11:59 +0000 (11:11 +0100)
commitcf7096728b9cd7d65f5c451e632ccd6366a92773
treead37a66412c9ae2684a908faf2745c4b83ee9ebb
parent73b144c4251bec2a4c7f2f7a4b12ef1ced4ac88b
ext4: check and assert if marking an no_delete evicting inode dirty

commit 0de3b4acedb3e8445d690f21ed212533d450b212 upstream.

In ext4_evict_inode(), if we evicting an inode in the 'no_delete' path,
it cannot be raced by another mark_inode_dirty(). If it happens,
someone else may accidentally dirty it without holding inode refcount
and probably cause use-after-free issues in the writeback procedure.
It's indiscoverable and hard to debug, so add an WARN_ON_ONCE() to
check and detect this issue in advance.

Suggested-by: Jan Kara <jack@suse.cz>
Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20220629112647.4141034-2-yi.zhang@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/inode.c