Skip to content

Commit a174706

Browse files
niharcykleikamp
authored andcommitted
jfs: add a check to prevent array-index-out-of-bounds in dbAdjTree
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]>
1 parent d9f9d96 commit a174706

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fs/jfs/jfs_dmap.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2891,6 +2891,9 @@ static void dbAdjTree(dmtree_t *tp, int leafno, int newval, bool is_ctl)
28912891
/* bubble the new value up the tree as required.
28922892
*/
28932893
for (k = 0; k < le32_to_cpu(tp->dmt_height); k++) {
2894+
if (lp == 0)
2895+
break;
2896+
28942897
/* get the index of the first leaf of the 4 leaf
28952898
* group containing the specified leaf (leafno).
28962899
*/

0 commit comments

Comments
 (0)