From: Thomas Fourier <fourier.thomas@gmail.com>
Cc: Thomas Fourier <fourier.thomas@gmail.com>,
Jaegeuk Kim <jaegeuk@kernel.org>, Chao Yu <chao@kernel.org>,
linux-f2fs-devel@lists.sourceforge.net (open list:F2FS FILE
SYSTEM), linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] f2fs: fix use after iput() of inode in gc_data_segment()
Date: Wed, 25 Nov 2026 11:34:54 +0100 [thread overview]
Message-ID: <20261125103502.30568-2-fourier.thomas@gmail.com> (raw)
In phase 3 of gc_data_segment(), if f2fs_has_inline_data(inode) is true,
inode may be freed by iput() before the error message reads
inode->i_ino.
Report the error before dropping the reference.
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
Fixes: fc01008c92f4 ("f2fs: fix to do sanity check on F2FS_INLINE_DATA flag in inode during GC")
---
fs/f2fs/gc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 0a00180c21dc..c7dc65acd052 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -1650,12 +1650,12 @@ static int gc_data_segment(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
}
if (f2fs_has_inline_data(inode)) {
- iput(inode);
set_sbi_flag(sbi, SBI_NEED_FSCK);
f2fs_err_ratelimited(sbi,
"inode %llu has both inline_data flag and "
"data block, nid=%u, ofs_in_node=%u",
inode->i_ino, dni.nid, ofs_in_node);
+ iput(inode);
continue;
}
--
2.53.0
reply other threads:[~2026-11-25 10:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261125103502.30568-2-fourier.thomas@gmail.com \
--to=fourier.thomas@gmail.com \
--cc=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/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®