Re: [syzbot] [jfs?] WARNING: fs/jfs/jfs_dmap.c:LINE at dbAdjTree, CPU: jfsCommit/NUM

From: Edward Adam Davis
Date: Mon Jun 16 2025 - 23:02:25 EST


#syz test

diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index 35e063c9f3a4..7e3c5f6826d8 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -2856,9 +2856,13 @@ static int dbJoin(dmtree_t *tp, int leafno, int newval, bool is_ctl)
static void dbAdjTree(dmtree_t *tp, int leafno, int newval, bool is_ctl)
{
int lp, pp, k;
- int max, size;
+ int max, size, max_idx;

size = is_ctl ? CTLTREESIZE : TREESIZE;
+ max_idx = is_ctl ? LPERCTL : LPERDMAP;
+
+ if (le32_to_cpu(tp->dmt_leafidx) >= max_idx)
+ return;

/* pick up the index of the leaf for this leafno.
*/