public inbox for gfs2@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] gfs2: replace WARN_ON_ONCE with fs_warn in rgblk_free
@ 2026-04-18 13:11 Tristan Madani
  0 siblings, 0 replies; only message in thread
From: Tristan Madani @ 2026-04-18 13:11 UTC (permalink / raw)
  To: agruenba; +Cc: gfs2, linux-kernel, syzbot+3e2c95229d1ab81a0bfd

From: Tristan Madani <tristan@talencesecurity.com>

rgblk_free() triggers WARN_ON_ONCE when gfs2_rbm_from_block() fails
due to a block number outside the resource group bounds. This can be
triggered by a corrupted filesystem image, causing unnecessary kernel
warnings.

Replace WARN_ON_ONCE with fs_warn() to provide a more informative
diagnostic message while avoiding the kernel warning.

Reported-by: syzbot+3e2c95229d1ab81a0bfd@syzkaller.appspotmail.com
Fixes: 5b924ae2b7b4 ("GFS2: fix rgrp end rounding problem for bsize < page size")
Cc: stable@vger.kernel.org
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
---
 fs/gfs2/rgrp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 26d6c1eea5591..7707c1b1082f8 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -2266,8 +2266,11 @@ static void rgblk_free(struct gfs2_sbd *sdp, struct gfs2_rgrpd *rgd,
 	struct gfs2_bitmap *bi, *bi_prev = NULL;
 
 	rbm.rgd = rgd;
-	if (WARN_ON_ONCE(gfs2_rbm_from_block(&rbm, bstart)))
+	if (gfs2_rbm_from_block(&rbm, bstart)) {
+		fs_warn(sdp, "rgblk_free: block %llu outside rgrp\n",
+			(unsigned long long)bstart);
 		return;
+	}
 	while (blen--) {
 		bi = rbm_bi(&rbm);
 		if (bi != bi_prev) {
-- 
2.47.3


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-04-18 13:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-18 13:11 [PATCH] gfs2: replace WARN_ON_ONCE with fs_warn in rgblk_free Tristan Madani

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox