]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
jfs: fix out-of-bounds in dbNextAG() and diAlloc()
authorJeongjun Park <aha310510@gmail.com>
Mon, 19 Aug 2024 04:05:46 +0000 (13:05 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2024 14:29:10 +0000 (16:29 +0200)
commitc1ba4b8ca799ff1d99d01f37d7ccb7d5ba5533d2
tree533f31483a78573daa768414ecfae71e3dd13a06
parentbaeb8628ab7f4577740f00e439d3fdf7c876b0ff
jfs: fix out-of-bounds in dbNextAG() and diAlloc()

[ Upstream commit e63866a475562810500ea7f784099bfe341e761a ]

In dbNextAG() , there is no check for the case where bmp->db_numag is
greater or same than MAXAG due to a polluted image, which causes an
out-of-bounds. Therefore, a bounds check should be added in dbMount().

And in dbNextAG(), a check for the case where agpref is greater than
bmp->db_numag should be added, so an out-of-bounds exception should be
prevented.

Additionally, a check for the case where agno is greater or same than
MAXAG should be added in diAlloc() to prevent out-of-bounds.

Reported-by: Jeongjun Park <aha310510@gmail.com>
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Jeongjun Park <aha310510@gmail.com>
Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/jfs/jfs_dmap.c
fs/jfs/jfs_imap.c