diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c --- a/fs/jfs/jfs_dmap.c +++ b/fs/jfs/jfs_dmap.c @@ -2770,6 +2770,10 @@ static int dbJoin(dmtree_t *tp, int leafno, int newval, bool is_ctl) int budsz, buddy; s8 *leaf; + if (newval < 0 || + (newval >= tp->dmt_budmin && newval - tp->dmt_budmin >= 32)) + return -EIO; + /* can the new leaf value require a join with other leaves ? */ if (newval >= tp->dmt_budmin) {