]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
drm/plane: Move range check for format_count earlier
authorSteven Price <steven.price@arm.com>
Fri, 3 Dec 2021 10:28:15 +0000 (10:28 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Jun 2022 14:59:16 +0000 (16:59 +0200)
commit4ab7e453a3ee88c274cf97bee9487ab92a66d313
tree9cb6875d794320c13baa2701ef5e9aeab0c6cb14
parent80c79a036a322d9c8122e471534177de18404412
drm/plane: Move range check for format_count earlier

[ Upstream commit 4b674dd69701c2e22e8e7770c1706a69f3b17269 ]

While the check for format_count > 64 in __drm_universal_plane_init()
shouldn't be hit (it's a WARN_ON), in its current position it will then
leak the plane->format_types array and fail to call
drm_mode_object_unregister() leaking the modeset identifier. Move it to
the start of the function to avoid allocating those resources in the
first place.

Signed-off-by: Steven Price <steven.price@arm.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
Link: https://lore.kernel.org/dri-devel/20211203102815.38624-1-steven.price@arm.com/
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/drm_plane.c