f2fs: fix use after iput() of inode in gc_data_segment()
PATCH 1/1 f2fs: fix use after iput() of inode in gc_data_segment()
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 <[email protected]>
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(-)
fs/f2fs/gc.c +1 -1
@@ -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 ; }
Signature · 1 line
2.53.0