mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] f2fs: fix use after iput() of inode in gc_data_segment()
@ 2026-11-25 10:34 Thomas Fourier
  0 siblings, 0 replies; only message in thread
From: Thomas Fourier @ 2026-11-25 10:34 UTC (permalink / raw)
  Cc: Thomas Fourier, Jaegeuk Kim, Chao Yu, open list:F2FS FILE SYSTEM,
	open list

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-25 10:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-25 10:34 [PATCH] f2fs: fix use after iput() of inode in gc_data_segment() Thomas Fourier

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®