]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
jfs: fix metapage reference count leak in dbAllocCtl
authorZheng Yu <zheng.yu@northwestern.edu>
Tue, 29 Jul 2025 01:22:14 +0000 (01:22 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Aug 2025 10:08:56 +0000 (12:08 +0200)
commit505f4111dd98ebf6f84247616eae43432ed985f9
tree047bae61612cbbb61b54fe8ca0f216268df123ce
parent4b5d36cc3014986e6fac12eaa8433fe56801d4ce
jfs: fix metapage reference count leak in dbAllocCtl

[ Upstream commit 856db37592021e9155384094e331e2d4589f28b1 ]

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: a5f5e4698f8abbb25fe4959814093fb5bfa1aa9d ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/jfs/jfs_dmap.c