[PATCH] drm/fb_dma: Add checks in drm_fb_dma_get_scanout_buffer()
Jocelyn Falempe
jfalempe at redhat.com
Tue Apr 30 14:29:33 UTC 2024
On 29/04/2024 09:24, Thomas Zimmermann wrote:
>
>
> 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
Thanks, I just merged it to drm-misc-next with that fixed.
>
> 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
>
--
Jocelyn
More information about the dri-devel
mailing list