[lvc-project] [PATCH 2/2] ocfs2: relax BUG() to ocfs2_error() in	__ocfs2_move_extent()
    Dmitry Antipov 
    dmantipov at yandex.ru
       
    Thu Oct  9 13:23:49 MSK 2025
    
    
  
In '__ocfs2_move_extent()', relax 'BUG()' to 'ocfs2_error()' just
to avoid crashing the whole kernel due to a filesystem corruption.
Reported-by: syzbot+727d161855d11d81e411 at syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=727d161855d11d81e411
Fixes: 8f603e567aa7 ("Ocfs2/move_extents: move a range of extent.")
Signed-off-by: Dmitry Antipov <dmantipov at yandex.ru>
---
 fs/ocfs2/move_extents.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/fs/ocfs2/move_extents.c b/fs/ocfs2/move_extents.c
index e038c009cdef..ba4952b41602 100644
--- a/fs/ocfs2/move_extents.c
+++ b/fs/ocfs2/move_extents.c
@@ -98,7 +98,13 @@ static int __ocfs2_move_extent(handle_t *handle,
 
 	rec = &el->l_recs[index];
 
-	BUG_ON(ext_flags != rec->e_flags);
+	if (ext_flags != rec->e_flags) {
+		ret = ocfs2_error(inode->i_sb,
+				  "Inode %llu has corrupted extent %d with flags 0x%x at cpos %u\n",
+				  (unsigned long long)ino, index, rec->e_flags, cpos);
+		goto out;
+	}
+
 	/*
 	 * after moving/defraging to new location, the extent is not going
 	 * to be refcounted anymore.
-- 
2.51.0
    
    
More information about the lvc-project
mailing list