diff options
author | Dinghao Liu <dinghao.liu@zju.edu.cn> | 2020-08-27 09:12:38 +0200 |
---|---|---|
committer | Dave Kleikamp <dave.kleikamp@oracle.com> | 2020-11-13 20:43:02 +0100 |
commit | 751341b4d7841e2b76e78eec382c2e119165497f (patch) | |
tree | 29e0e91658ce108aa36d16c76e7576a341b1d2de /fs/jfs | |
parent | jfs: delete duplicated words + other fixes (diff) | |
download | linux-751341b4d7841e2b76e78eec382c2e119165497f.tar.xz linux-751341b4d7841e2b76e78eec382c2e119165497f.zip |
jfs: Fix memleak in dbAdjCtl
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>
Diffstat (limited to 'fs/jfs')
-rw-r--r-- | fs/jfs/jfs_dmap.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c index dc02c7faf01f..94b7c1cb5ceb 100644 --- a/fs/jfs/jfs_dmap.c +++ b/fs/jfs/jfs_dmap.c @@ -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 |