]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
hfs: fix slab-out-of-bounds in hfs_bnode_read()
authorViacheslav Dubeyko <slava@dubeyko.com>
Thu, 3 Jul 2025 21:49:12 +0000 (14:49 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:28:14 +0000 (16:28 +0200)
commit384a66b89f9540a9a8cb0f48807697dfabaece4c
tree681ae8db1be3b48633820a687b8e3f2ed2d9f3ef
parent4f032979b63ad52e08aadf0faeac34ed35133ec0
hfs: fix slab-out-of-bounds in hfs_bnode_read()

[ Upstream commit a431930c9bac518bf99d6b1da526a7f37ddee8d8 ]

This patch introduces is_bnode_offset_valid() method that checks
the requested offset value. Also, it introduces
check_and_correct_requested_length() method that checks and
correct the requested length (if it is necessary). These methods
are used in hfs_bnode_read(), hfs_bnode_write(), hfs_bnode_clear(),
hfs_bnode_copy(), and hfs_bnode_move() with the goal to prevent
the access out of allocated memory and triggering the crash.

Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
Link: https://lore.kernel.org/r/20250703214912.244138-1-slava@dubeyko.com
Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/hfs/bnode.c