[RESEND,V2] drm: fsl-dcu: Fix no fb check bug

Emil Velikov emil.l.velikov at gmail.com
Tue Jan 26 13:18:05 PST 2016


On 14 January 2016 at 08:23, Meng Yi <meng.yi at nxp.com> wrote:
>> >>         switch (fb->pixel_format) {
>> >>         case DRM_FORMAT_RGB565:
>> >>         case DRM_FORMAT_RGB888:
>> >> @@ -85,9 +88,6 @@ static void fsl_dcu_drm_plane_atomic_update(struct
>> drm_plane *plane,
>> >>         unsigned int alpha, bpp;
>> >>         int index, ret;
>> >>
>> >> -       if (!fb)
>> >> -               return;
>> >> -
>> > ... which no longer has the !fb check, and we'll crash with null deref
>> > a few lines below ?
>>
>>
>> If there is a legitimate situation where fb is null which also ultimately leads to a
>> atomic_commit, I guess we should keep the return here...
>
> I think I made a mistake here, fb check should not be removed . As Stefan mentioned, if fb check in fsl_dcu_drm_plane_atomic_check return 0, fsl_dcu_drm_plane_atomic_update will ultimately called, and we'll crash since plane->state->fb is NULL.
>
I believe you meant "Emil" in the above ;-) But seriously... afaict a
fair few drivers do a similar !fb (even !state->crtc) check(s)...
which makes me wonder if core DRM isn't the better place for it ? Or
perhaps that's intentional as core provides the flexibility for each
driver to mangle with the fb between .check and .disable ?

Cheers
Emil

P.S. Please don't top post, use interleaved style [1]

[1] https://en.wikipedia.org/wiki/Posting_style#Interleaved_style


More information about the dri-devel mailing list