drm/rockchip: check yuv2yuv existence before assigning window data
diff mbox series

Message ID 2556882.Heuq80WCVD@phil
State New
Headers show
Series
  • drm/rockchip: check yuv2yuv existence before assigning window data
Related show

Commit Message

Heiko Stuebner Jan. 26, 2019, 12:24 a.m. UTC
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 <heiko@sntech.de>
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Ezequiel Garcia Jan. 26, 2019, 2:52 p.m. UTC | #1
On Sat, 2019-01-26 at 01:24 +0100, Heiko Stuebner wrote:
> 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 <heiko@sntech.de>
> ---
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index 619b6db05d58..1dc9fd1ffbe3 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];
>  	}
>  }
>  

Ugh, another one of these.

Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>

Thanks,
Eze
Heiko Stuebner Jan. 27, 2019, 8:43 p.m. UTC | #2
Am Samstag, 26. Januar 2019, 01:24:37 CET schrieb Heiko Stuebner:
> 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 <heiko@sntech.de>

applied to drm-misc-next where the fixed commit also waits for the
next merge-window.


Heiko

Patch
diff mbox series

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index 619b6db05d58..1dc9fd1ffbe3 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];
 	}
 }