validate_gl_shader_rec() accepts a shader BO handle equal to exec->bo_count, reading one entry past the end of exec->bo[] and using it as a GEM object.
Reject handles that aren't below exec->bo_count. Cc: [email protected] Fixes: d5b1a78a772f ("drm/vc4: Add support for drawing 3D frames.") Signed-off-by: Maíra Canal <[email protected]> --- drivers/gpu/drm/vc4/vc4_validate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_validate.c b/drivers/gpu/drm/vc4/vc4_validate.c index 565227657b43..0d2b08abf1ad 100644 --- a/drivers/gpu/drm/vc4/vc4_validate.c +++ b/drivers/gpu/drm/vc4/vc4_validate.c @@ -815,7 +815,7 @@ validate_gl_shader_rec(struct drm_device *dev, exec->shader_rec_size -= packet_size; for (i = 0; i < shader_reloc_count; i++) { - if (src_handles[i] > exec->bo_count) { + if (src_handles[i] >= exec->bo_count) { DRM_DEBUG("Shader handle %d too big\n", src_handles[i]); return -EINVAL; } -- 2.56.0
