Skip to content
Commit c9226080 authored by Maxime Ripard's avatar Maxime Ripard Committed by Phil Elwell
Browse files

drm/vc4: hvs: Fix buffer overflow with the dlist handling



Commit 0a038c1c ("drm/vc4: Move LBM creation out of
vc4_plane_mode_set()") changed the LBM allocation logic from first
allocating the LBM memory for the plane to running mode_set,
adding a gap in the LBM, and then running the dlist allocation filling
that gap.

The gap was introduced by incrementing the dlist array index, but was
never checking whether or not we were over the array length, leading
eventually to memory corruptions if we ever crossed this limit.

vc4_dlist_write had that logic though, and was reallocating a larger
dlist array when reaching the end of the buffer. Let's share the logic
between both functions.

Cc: Boris Brezillon <boris.brezillon@collabora.com>
Cc: Eric Anholt <eric@anholt.net>
Fixes: 0a038c1c ("drm/vc4: Move LBM creation out of vc4_plane_mode_set()")
Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
parent f4590cfb
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment