mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:41:42 +00:00
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: syzbot+412dea214d8baa3f7483@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=412dea214d8baa3f7483 Tested-by: syzbot+412dea214d8baa3f7483@syzkaller.appspotmail.com Signed-off-by: Nihar Chaithanya <niharchaithanya@gmail.com> Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
This commit is contained in:
parent
d9f9d96136
commit
a174706ba4
@ -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).
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user