Skip to content

Commit

Permalink
jfs: Fix memleak in dbAdjCtl
Browse files Browse the repository at this point in the history
When dbBackSplit() fails, mp should be released to
prevent memleak. It's the same when dbJoin() fails.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
  • Loading branch information
dinghaoliu authored and kleikamp committed Nov 13, 2020
1 parent ed1c9a7 commit 751341b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions fs/jfs/jfs_dmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -2549,15 +2549,19 @@ dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level)
*/
if (oldval == NOFREE) {
rc = dbBackSplit((dmtree_t *) dcp, leafno);
if (rc)
if (rc) {
release_metapage(mp);
return rc;
}
oldval = dcp->stree[ti];
}
dbSplit((dmtree_t *) dcp, leafno, dcp->budmin, newval);
} else {
rc = dbJoin((dmtree_t *) dcp, leafno, newval);
if (rc)
if (rc) {
release_metapage(mp);
return rc;
}
}

/* check if the root of the current dmap control page changed due
Expand Down

0 comments on commit 751341b

Please sign in to comment.