[PATCH] drm/fb_dma: Add checks in drm_fb_dma_get_scanout_buffer()
Thomas Zimmermann
tzimmermann at suse.de
Mon Apr 29 07:24:42 UTC 2024
Am 26.04.24 um 14:10 schrieb Jocelyn Falempe:
> plane->state and plane->state->fb can be NULL, so add a check before
> dereferencing them.
> Found by testing with the imx driver.
>
> Fixes: 879b3b6511fe9 ("drm/fb_dma: Add generic get_scanout_buffer() for drm_panic")
> Signed-off-by: Jocelyn Falempe <jfalempe at redhat.com>
> ---
> drivers/gpu/drm/drm_fb_dma_helper.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_fb_dma_helper.c b/drivers/gpu/drm/drm_fb_dma_helper.c
> index 96e5ab960f12..d7bffde94cc5 100644
> --- a/drivers/gpu/drm/drm_fb_dma_helper.c
> +++ b/drivers/gpu/drm/drm_fb_dma_helper.c
> @@ -167,6 +167,9 @@ int drm_fb_dma_get_scanout_buffer(struct drm_plane *plane,
> struct drm_gem_dma_object *dma_obj;
> struct drm_framebuffer *fb;
>
> + if (!plane->state || !plane->state->fb)
> + return -ENODEV;
> +
It's EINVAL here. With that fixed, free free to add
Reviewed-by: Thomas Zimmermann <tzimmermann at suse.de>
Best regards
Thomas
> fb = plane->state->fb;
> /* Only support linear modifier */
> if (fb->modifier != DRM_FORMAT_MOD_LINEAR)
>
> base-commit: 2e3f08a1ac99cb9a19a5cb151593d4f9df5cc6a7
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
More information about the dri-devel
mailing list