From: Heiko Stuebner Date: Sat, 26 Jan 2019 00:24:37 +0000 (+0100) Subject: drm/rockchip: check yuv2yuv existence before assigning window data X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=ce6912b4074d11f567cef33d59d98dd4032bd94e;p=openwrt%2Fstaging%2Fblogic.git drm/rockchip: check yuv2yuv existence before assigning window data Before assigning window data, we should check if the yuv2yuv vop-data is set at all, because it looks like it can otherwise reference something wrong, as I saw on my rk3188 today which ended up in a null pointer dereference in vop_plane_atomic_update when accessing the yuv2yuv data. Fixes: 1c21aa8f2b68 ("drm/rockchip: Fix YUV buffers color rendering") Signed-off-by: Heiko Stuebner Reviewed-by: Ezequiel Garcia Link: https://patchwork.freedesktop.org/patch/msgid/2556882.Heuq80WCVD@phil --- diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index c2679200d865..c7d4c6073ea5 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -1675,7 +1675,9 @@ static void vop_win_init(struct vop *vop) vop_win->data = win_data; vop_win->vop = vop; - vop_win->yuv2yuv_data = &vop_data->win_yuv2yuv[i]; + + if (vop_data->win_yuv2yuv) + vop_win->yuv2yuv_data = &vop_data->win_yuv2yuv[i]; } }