Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "drm/amdgpu: validate user GEM object size"

It was at the same time too strict (for linear tiling modes, where no
height alignment is required) and too lenient (for 2D tiling modes,
where height may need to be aligned to values > 8).

Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

-8
-8
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
··· 531 531 struct drm_gem_object *obj; 532 532 struct amdgpu_framebuffer *amdgpu_fb; 533 533 int ret; 534 - int height; 535 534 struct amdgpu_device *adev = dev->dev_private; 536 535 int cpp = drm_format_plane_cpp(mode_cmd->pixel_format, 0); 537 536 int pitch = mode_cmd->pitches[0] / cpp; ··· 552 553 /* Handle is imported dma-buf, so cannot be migrated to VRAM for scanout */ 553 554 if (obj->import_attach) { 554 555 DRM_DEBUG_KMS("Cannot create framebuffer from imported dma_buf\n"); 555 - return ERR_PTR(-EINVAL); 556 - } 557 - 558 - height = ALIGN(mode_cmd->height, 8); 559 - if (obj->size < pitch * height) { 560 - DRM_DEBUG_KMS("Invalid GEM size: expecting >= %d but got %zu\n", 561 - pitch * height, obj->size); 562 556 return ERR_PTR(-EINVAL); 563 557 } 564 558