Skip to content

Commit 1661057

Browse files
committed
drm/vc4: Fix an integer overflow in temporary allocation layout.
We copy the unvalidated ioctl arguments from the user into kernel temporary memory to run the validation from, to avoid a race where the user updates the unvalidate contents in between validating them and copying them into the validated BO. However, in setting up the layout of the kernel side, we failed to check one of the additions (the roundup() for shader_rec_offset) against integer overflow, allowing a nearly MAX_UINT value of bin_cl_size to cause us to under-allocate the temporary space that we then copy_from_user into. Reported-by: Murray McAllister <[email protected]> Signed-off-by: Eric Anholt <[email protected]> Fixes: d5b1a78 ("drm/vc4: Add support for drawing 3D frames.") (cherry picked from commit 0f2ff82)
1 parent f8cb6fa commit 1661057

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/gpu/drm/vc4/vc4_gem.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,8 @@ vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec)
594594
args->shader_rec_count);
595595
struct vc4_bo *bo;
596596

597-
if (uniforms_offset < shader_rec_offset ||
597+
if (shader_rec_offset < args->bin_cl_size ||
598+
uniforms_offset < shader_rec_offset ||
598599
exec_size < uniforms_offset ||
599600
args->shader_rec_count >= (UINT_MAX /
600601
sizeof(struct vc4_shader_state)) ||

0 commit comments

Comments
 (0)