]> Git Repo - linux.git/commitdiff
jfs: add a check to prevent array-index-out-of-bounds in dbAdjTree
authorNihar Chaithanya <[email protected]>
Tue, 8 Oct 2024 20:21:38 +0000 (01:51 +0530)
committerDave Kleikamp <[email protected]>
Tue, 29 Oct 2024 22:43:41 +0000 (17:43 -0500)
When the value of lp is 0 at the beginning of the for loop, it will
become negative in the next assignment and we should bail out.

Reported-by: [email protected]
Closes: https://syzkaller.appspot.com/bug?extid=412dea214d8baa3f7483
Tested-by: [email protected]
Signed-off-by: Nihar Chaithanya <[email protected]>
Signed-off-by: Dave Kleikamp <[email protected]>
fs/jfs/jfs_dmap.c

index 39957361a7eedfd4778fe99731f147ec3d2e21f2..f9009e4f9ffd89c39e39ae4575a012d21919a36d 100644 (file)
@@ -2891,6 +2891,9 @@ static void dbAdjTree(dmtree_t *tp, int leafno, int newval, bool is_ctl)
        /* bubble the new value up the tree as required.
         */
        for (k = 0; k < le32_to_cpu(tp->dmt_height); k++) {
+               if (lp == 0)
+                       break;
+
                /* get the index of the first leaf of the 4 leaf
                 * group containing the specified leaf (leafno).
                 */
This page took 0.063921 seconds and 4 git commands to generate.