Skip to content

Commit 856db37

Browse files
cla7aye15I4ndkleikamp
authored andcommitted
jfs: fix metapage reference count leak in dbAllocCtl
In dbAllocCtl(), read_metapage() increases the reference count of the metapage. However, when dp->tree.budmin < 0, the function returns -EIO without calling release_metapage() to decrease the reference count, leading to a memory leak. Add release_metapage(mp) before the error return to properly manage the metapage reference count and prevent the leak. Fixes: a5f5e46 ("jfs: fix shift-out-of-bounds in dbSplit") Signed-off-by: Zheng Yu <[email protected]> Signed-off-by: Dave Kleikamp <[email protected]>
1 parent b89798e commit 856db37

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/jfs/jfs_dmap.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1815,8 +1815,10 @@ dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results)
18151815
return -EIO;
18161816
dp = (struct dmap *) mp->data;
18171817

1818-
if (dp->tree.budmin < 0)
1818+
if (dp->tree.budmin < 0) {
1819+
release_metapage(mp);
18191820
return -EIO;
1821+
}
18201822

18211823
/* try to allocate the blocks.
18221824
*/

0 commit comments

Comments
 (0)