mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
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: a5f5e4698f
("jfs: fix shift-out-of-bounds in dbSplit")
Signed-off-by: Zheng Yu <zheng.yu@northwestern.edu>
Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
This commit is contained in:
parent
b89798e79c
commit
856db37592
1 changed files with 3 additions and 1 deletions
|
@ -1815,8 +1815,10 @@ dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results)
|
|||
return -EIO;
|
||||
dp = (struct dmap *) mp->data;
|
||||
|
||||
if (dp->tree.budmin < 0)
|
||||
if (dp->tree.budmin < 0) {
|
||||
release_metapage(mp);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
/* try to allocate the blocks.
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue