Commit 8a7d5884 authored by Dmitry Antipov's avatar Dmitry Antipov Committed by Andrew Morton
Browse files

ocfs2: relax BUG() to ocfs2_error() in __ocfs2_move_extent()

In '__ocfs2_move_extent()', relax 'BUG()' to 'ocfs2_error()' just
to avoid crashing the whole kernel due to a filesystem corruption.

Fixes: 8f603e56 ("Ocfs2/move_extents: move a range of extent.")
Link: https://lkml.kernel.org/r/20251009102349.181126-2-dmantipov@yandex.ru


Signed-off-by: default avatarDmitry Antipov <dmantipov@yandex.ru>
Closes: https://syzkaller.appspot.com/bug?extid=727d161855d11d81e411


Reported-by: default avatar <syzbot+727d161855d11d81e411@syzkaller.appspotmail.com>
Reviewed-by: default avatarJoseph Qi <joseph.qi@linux.alibaba.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Jun Piao <piaojun@huawei.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 41a5e877
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -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.