Skip to content

Commit 514ca22

Browse files
Jocelyn Falempemlankhorst
authored andcommitted
drm/fb_dma: Add checks in drm_fb_dma_get_scanout_buffer()
plane->state and plane->state->fb can be NULL, so add a check before dereferencing them. Found by testing with the imx driver. Fixes: 879b3b6 ("drm/fb_dma: Add generic get_scanout_buffer() for drm_panic") Signed-off-by: Jocelyn Falempe <[email protected]> Reviewed-by: Thomas Zimmermann <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit 986c12d) Signed-off-by: Maarten Lankhorst <[email protected]>
1 parent 87cb4a6 commit 514ca22

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/gpu/drm/drm_fb_dma_helper.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ int drm_fb_dma_get_scanout_buffer(struct drm_plane *plane,
167167
struct drm_gem_dma_object *dma_obj;
168168
struct drm_framebuffer *fb;
169169

170+
if (!plane->state || !plane->state->fb)
171+
return -EINVAL;
172+
170173
fb = plane->state->fb;
171174
/* Only support linear modifier */
172175
if (fb->modifier != DRM_FORMAT_MOD_LINEAR)

0 commit comments

Comments
 (0)