summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_gem_atomic_helper.c
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2022-05-17 13:33:24 +0200
committerThomas Zimmermann <tzimmermann@suse.de>2022-05-19 19:25:02 +0200
commit746b9c62cc8614fa59c23f3332682b5e9e1d801c (patch)
treec9c4bbce1089935a06f57e478e533e34453e9f9e /drivers/gpu/drm/drm_gem_atomic_helper.c
parentf159b1b22c8a2d3d7c1fa877fafc8aacff0deeba (diff)
downloadlwn-746b9c62cc8614fa59c23f3332682b5e9e1d801c.tar.gz
lwn-746b9c62cc8614fa59c23f3332682b5e9e1d801c.zip
drm/gem: Ignore color planes that are unused by framebuffer format
Only handle color planes that exist in a framebuffer's color format. Ignore non-existing planes. So far, several helpers assumed that all 4 planes are available and silently ignored non-existing planes. This lead to subtil bugs with uninitialized data in instances of struct iosys_map. [1] Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Tested-by: Noralf Trønnes <noralf@tronnes.org> Acked-by: Christian König <christian.koenig@amd.com> Link: https://lore.kernel.org/dri-devel/20210730183511.20080-1-tzimmermann@suse.de/T/#md0172b10bb588d8f20f4f456e304f08d2a4505f7 # 1 Link: https://patchwork.freedesktop.org/patch/msgid/20220517113327.26919-3-tzimmermann@suse.de
Diffstat (limited to 'drivers/gpu/drm/drm_gem_atomic_helper.c')
-rw-r--r--drivers/gpu/drm/drm_gem_atomic_helper.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_gem_atomic_helper.c b/drivers/gpu/drm/drm_gem_atomic_helper.c
index a5026f617739..f16d60217c6c 100644
--- a/drivers/gpu/drm/drm_gem_atomic_helper.c
+++ b/drivers/gpu/drm/drm_gem_atomic_helper.c
@@ -169,8 +169,10 @@ int drm_gem_plane_helper_prepare_fb(struct drm_plane *plane,
struct drm_gem_object *obj = drm_gem_fb_get_obj(state->fb, i);
struct dma_fence *new;
- if (WARN_ON_ONCE(!obj))
- continue;
+ if (!obj) {
+ ret = -EINVAL;
+ goto error;
+ }
ret = dma_resv_get_singleton(obj->resv, usage, &new);
if (ret)