[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YrSZAMYzEkXUExNG@art_vandelay>
Date: Thu, 23 Jun 2022 16:46:56 +0000
From: Sean Paul <sean@...rly.run>
To: Brian Norris <briannorris@...omium.org>
Cc: Daniel Vetter <daniel@...ll.ch>, David Airlie <airlied@...ux.ie>,
Heiko Stübner <heiko@...ech.de>,
Doug Anderson <dianders@...omium.org>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
linux-rockchip@...ts.infradead.org,
Sandy Huang <hjc@...k-chips.com>,
Sean Paul <seanpaul@...omium.org>
Subject: Re: [PATCH] drm/rockchip: vop: Don't crash for invalid
duplicate_state()
On Fri, Jun 17, 2022 at 05:26:52PM -0700, Brian Norris wrote:
> It's possible for users to try to duplicate the CRTC state even when the
> state doesn't exist. drm_atomic_helper_crtc_duplicate_state() (and other
> users of __drm_atomic_helper_crtc_duplicate_state()) already guard this
> with a WARN_ON() instead of crashing, so let's do that here too.
>
> Signed-off-by: Brian Norris <briannorris@...omium.org>
Thanks for this patch!
Reviewed-by: Sean Paul <seanpaul@...omium.org>
> ---
>
> drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index 74562d40f639..daf192881353 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -1570,6 +1570,9 @@ static struct drm_crtc_state *vop_crtc_duplicate_state(struct drm_crtc *crtc)
> {
> struct rockchip_crtc_state *rockchip_state;
>
> + if (WARN_ON(!crtc->state))
> + return NULL;
> +
> rockchip_state = kzalloc(sizeof(*rockchip_state), GFP_KERNEL);
> if (!rockchip_state)
> return NULL;
> --
> 2.36.1.476.g0c4daa206d-goog
>
--
Sean Paul, Software Engineer, Google / Chromium OS
Powered by blists - more mailing lists