From patchwork Sat Jan 26 00:24:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Heiko_St=C3=BCbner?= X-Patchwork-Id: 10782225 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2961B139A for ; Sat, 26 Jan 2019 00:24:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C40029BA9 for ; Sat, 26 Jan 2019 00:24:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 39A9930816; Sat, 26 Jan 2019 00:24:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6F03129BA9 for ; Sat, 26 Jan 2019 00:24:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BA6DB6E0D1; Sat, 26 Jan 2019 00:24:44 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from gloria.sntech.de (gloria.sntech.de [185.11.138.130]) by gabe.freedesktop.org (Postfix) with ESMTPS id CC7A26E0D1 for ; Sat, 26 Jan 2019 00:24:43 +0000 (UTC) Received: from p5b1278e7.dip0.t-ipconnect.de ([91.18.120.231] helo=phil.localnet) by gloria.sntech.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gnBm2-0002Tk-Cr; Sat, 26 Jan 2019 01:24:38 +0100 From: Heiko Stuebner To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/rockchip: check yuv2yuv existence before assigning window data Date: Sat, 26 Jan 2019 01:24:37 +0100 Message-ID: <2556882.Heuq80WCVD@phil> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ezequiel@collabora.com, linux-rockchip@lists.infradead.org, dcastagna@chromium.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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]; } }