Forwarded: Re: [syzbot] WARNING in gfs2_check_blk_type

syzbot posted 1 patch 1 month, 4 weeks ago
fs/gfs2/rgrp.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Forwarded: Re: [syzbot] WARNING in gfs2_check_blk_type
Posted by syzbot 1 month, 4 weeks ago
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.

***

Subject: Re: [syzbot] WARNING in gfs2_check_blk_type
Author: tristmd@gmail.com

#syz test: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>From a57e64056f6b6fa2ede96b624b49baeb5269478b Mon Sep 17 00:00:00 2001
From: Tristan Madani <tristan@talencesecurity.com>
Date: Fri, 17 Apr 2026 16:15:20 +0000
Subject: [PATCH] gfs2: remove WARN_ON_ONCE in gfs2_check_blk_type()
gfs2_check_blk_type() wraps gfs2_rbm_from_block() in
!WARN_ON_ONCE(), triggering a kernel WARNING on corrupted
filesystems. Replace with a plain error check and map the
error to -ESTALE for the caller.
Reported-by: syzbot+26e96d7e92eed8a21405@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=26e96d7e92eed8a21405
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
---
 fs/gfs2/rgrp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 5988a16..da94c25 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -2625,7 +2625,9 @@ int gfs2_check_blk_type(struct gfs2_sbd *sdp, u64 no_addr, unsigned int type)
 
 	rbm.rgd = rgd;
 	error = gfs2_rbm_from_block(&rbm, no_addr);
-	if (!WARN_ON_ONCE(error)) {
+	if (error) {
+		error = -ESTALE;
+	} else {
 		/*
 		 * No need to take the local resource group lock here; the
 		 * inode glock of @no_addr provides the necessary
-- 
2.47.3