From: Svyatoslav Feldsherov <feldsherov@google.com>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
Lukas Czerner <lczerner@redhat.com>,
"Theodore Ts'o" <tytso@mit.edu>, Jan Kara <jack@suse.cz>
Cc: syzbot+6ba92bd00d5093f7e371@syzkaller.appspotmail.com,
oferz@google.com, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org,
Svyatoslav Feldsherov <feldsherov@google.com>
Subject: [PATCH] fs: do not push freeing inode to b_dirty_time list
Date: Sun, 13 Nov 2022 17:24:39 +0200 [thread overview]
Message-ID: <20221113152439.2821942-1-feldsherov@google.com> (raw)
After commit cbfecb927f42 ("fs: record I_DIRTY_TIME even if inode
already has I_DIRTY_INODE") writeiback_single_inode can push inode with
I_DIRTY_TIME set to b_dirty_time list. In case of freeing inode with
I_DIRTY_TIME set this can happened after deletion of inode io_list at
evict. Stack trace is following.
evict
fat_evict_inode
fat_truncate_blocks
fat_flush_inodes
writeback_inode
sync_inode_metadata
writeback_single_inode
This will lead to use after free in flusher thread.
Fixes: cbfecb927f42 ("fs: record I_DIRTY_TIME even if inode already has I_DIRTY_INODE")
Reported-by: syzbot+6ba92bd00d5093f7e371@syzkaller.appspotmail.com
Signed-off-by: Svyatoslav Feldsherov <feldsherov@google.com>
---
fs/fs-writeback.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 443f83382b9b..31c93cbdb3fe 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -1718,7 +1718,7 @@ static int writeback_single_inode(struct inode *inode,
*/
if (!(inode->i_state & I_DIRTY_ALL))
inode_cgwb_move_to_attached(inode, wb);
- else if (!(inode->i_state & I_SYNC_QUEUED)) {
+ else if (!(inode->i_state & (I_SYNC_QUEUED | I_FREEING))) {
if ((inode->i_state & I_DIRTY))
redirty_tail_locked(inode, wb);
else if (inode->i_state & I_DIRTY_TIME) {
--
2.38.1.431.g37b22c650d-goog
next reply other threads:[~2022-11-13 15:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-13 15:24 Svyatoslav Feldsherov [this message]
2022-11-14 10:46 ` Jan Kara
2022-11-14 17:43 ` Svyatoslav Feldsherov
2022-11-14 19:21 ` Jan Kara
2022-11-14 21:21 ` [PATCH v2] fs: do not update freeing inode io_list Svyatoslav Feldsherov
2022-11-14 21:25 ` Randy Dunlap
2022-11-15 9:19 ` Svyatoslav Feldsherov
2022-11-15 10:55 ` Jan Kara
2022-11-15 20:28 ` Svyatoslav Feldsherov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221113152439.2821942-1-feldsherov@google.com \
--to=feldsherov@google.com \
--cc=jack@suse.cz \
--cc=lczerner@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oferz@google.com \
--cc=syzbot+6ba92bd00d5093f7e371@syzkaller.appspotmail.com \
--cc=tytso@mit.edu \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®