Commit cca974da authored by Manas Ghandat's avatar Manas Ghandat Committed by Dave Kleikamp

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=411debe54d318eaed386Signed-off-by: default avatarManas Ghandat <ghandatmanas@gmail.com>
Signed-off-by: default avatarDave Kleikamp <dave.kleikamp@oracle.com>
parent e0e1958f
...@@ -2763,7 +2763,9 @@ static int dbBackSplit(dmtree_t *tp, int leafno, bool is_ctl) ...@@ -2763,7 +2763,9 @@ static int dbBackSplit(dmtree_t *tp, int leafno, bool is_ctl)
* leafno - the number of the leaf to be updated. * leafno - the number of the leaf to be updated.
* newval - the new value for the leaf. * newval - the new value for the leaf.
* *
* RETURN VALUES: none * RETURN VALUES:
* 0 - success
* -EIO - i/o error
*/ */
static int dbJoin(dmtree_t *tp, int leafno, int newval, bool is_ctl) static int dbJoin(dmtree_t *tp, int leafno, int newval, bool is_ctl)
{ {
...@@ -2790,6 +2792,10 @@ static int dbJoin(dmtree_t *tp, int leafno, int newval, bool is_ctl) ...@@ -2790,6 +2792,10 @@ static int dbJoin(dmtree_t *tp, int leafno, int newval, bool is_ctl)
* get the buddy size (number of words covered) of * get the buddy size (number of words covered) of
* the new value. * the new value.
*/ */
if ((newval - tp->dmt_budmin) > BUDMIN)
return -EIO;
budsz = BUDSIZE(newval, tp->dmt_budmin); budsz = BUDSIZE(newval, tp->dmt_budmin);
/* try to join. /* try to join.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment