gfs2: Fix invalid metadata access in punch_hole
authorAndrew Price <anprice@redhat.com>
Mon, 11 Mar 2024 15:40:36 +0000 (16:40 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 May 2024 09:50:52 +0000 (11:50 +0200)
commitf5d95eead3584f7a1ba7f0a9fe131cfa85a6739f
tree6c83f95558477a1f988a94b7b403bd25943c5162
parent4cab23bbcb98ddd3fe89b828a4e9c68ccbf176af
gfs2: Fix invalid metadata access in punch_hole

[ Upstream commit c95346ac918c5badf51b9a7ac58a26d3bd5bb224 ]

In punch_hole(), when the offset lies in the final block for a given
height, there is no hole to punch, but the maximum size check fails to
detect that.  Consequently, punch_hole() will try to punch a hole beyond
the end of the metadata and fail.  Fix the maximum size check.

Signed-off-by: Andrew Price <anprice@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/gfs2/bmap.c