lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <693406aa.a70a0220.38f243.0022.GAE@google.com>
Date: Sat, 06 Dec 2025 02:34:18 -0800
From: syzbot <syzbot+4235e4d7b6fd75704528@...kaller.appspotmail.com>
To: linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com
Subject: Forwarded: [PATCH] f2fs: fix infinite loop in block_operations() on
 CP error

For archival purposes, forwarding an incoming command email to
linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com.

***

Subject: [PATCH] f2fs: fix infinite loop in block_operations() on CP error
Author: kartikey406@...il.com

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

When IO errors occur and CP_ERROR_FLAG is set, the retry loops in
block_operations() can spin forever. The sync functions (f2fs_sync_dirty_inodes,
f2fs_sync_inode_meta, f2fs_sync_node_pages) may return success even though
dirty pages remain due to IO errors, causing infinite retry loops.

The hung task traces show:
  f2fs: block_ops check DIRTY_IMETA=1
  f2fs: block_ops retry_flush_quotas cnt=0
  f2fs: block_ops retry_flush_dents dirty_dents=0
  f2fs: block_ops check DIRTY_IMETA=1
  ... (repeats forever)

Add f2fs_cp_error() checks after each sync operation in block_operations()
to break out of retry loops when the filesystem is in error state.

Reported-by: syzbot+4235e4d7b6fd75704528@...kaller.appspotmail.com
Signed-off-by: Deepanshu Kartikey <kartikey406@...il.com>
---
 fs/f2fs/checkpoint.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index bbe07e3a6c75..a6f831ed3d9b 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -1236,6 +1236,8 @@ static int block_operations(struct f2fs_sb_info *sbi)
 			f2fs_do_quota_sync(sbi->sb, -1);
 			up_read(&sbi->sb->s_umount);
 		}
+		if (unlikely(f2fs_cp_error(sbi)))
+			return -EIO;
 		cond_resched();
 		goto retry_flush_quotas;
 	}
@@ -1247,6 +1249,8 @@ static int block_operations(struct f2fs_sb_info *sbi)
 		err = f2fs_sync_dirty_inodes(sbi, DIR_INODE, true);
 		if (err)
 			return err;
+		if (unlikely(f2fs_cp_error(sbi)))
+			return -EIO;
 		cond_resched();
 		goto retry_flush_quotas;
 	}
@@ -1263,6 +1267,8 @@ static int block_operations(struct f2fs_sb_info *sbi)
 		err = f2fs_sync_inode_meta(sbi);
 		if (err)
 			return err;
+		if (unlikely(f2fs_cp_error(sbi)))
+			return -EIO;
 		cond_resched();
 		goto retry_flush_quotas;
 	}
@@ -1280,6 +1286,11 @@ static int block_operations(struct f2fs_sb_info *sbi)
 			f2fs_unlock_all(sbi);
 			return err;
 		}
+		if (unlikely(f2fs_cp_error(sbi))) {
+			f2fs_up_write(&sbi->node_change);
+			f2fs_unlock_all(sbi);
+			return -EIO;
+		}
 		cond_resched();
 		goto retry_flush_nodes;
 	}
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ