Skip to content

Commit cca974d

Browse files
manasghandatkleikamp
authored andcommitted
jfs: fix shift-out-of-bounds in dbJoin
Currently while joining the leaf in a buddy system there is shift out of bound error in calculation of BUDSIZE. Added the required check to the BUDSIZE and fixed the documentation as well. Reported-by: syzbot+411debe54d318eaed386@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=411debe54d318eaed386 Signed-off-by: Manas Ghandat <ghandatmanas@gmail.com> Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
1 parent e0e1958 commit cca974d

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

fs/jfs/jfs_dmap.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2763,7 +2763,9 @@ static int dbBackSplit(dmtree_t *tp, int leafno, bool is_ctl)
27632763
* leafno - the number of the leaf to be updated.
27642764
* newval - the new value for the leaf.
27652765
*
2766-
* RETURN VALUES: none
2766+
* RETURN VALUES:
2767+
* 0 - success
2768+
* -EIO - i/o error
27672769
*/
27682770
static int dbJoin(dmtree_t *tp, int leafno, int newval, bool is_ctl)
27692771
{
@@ -2790,6 +2792,10 @@ static int dbJoin(dmtree_t *tp, int leafno, int newval, bool is_ctl)
27902792
* get the buddy size (number of words covered) of
27912793
* the new value.
27922794
*/
2795+
2796+
if ((newval - tp->dmt_budmin) > BUDMIN)
2797+
return -EIO;
2798+
27932799
budsz = BUDSIZE(newval, tp->dmt_budmin);
27942800

27952801
/* try to join.

0 commit comments

Comments
 (0)