On Wed, Jun 21, 2023 at 10:33:20PM +0000, Jonas Karlman wrote: > Allocation of crtc_state may fail in vop_crtc_reset, causing an invalid > pointer to be passed to __drm_atomic_helper_crtc_reset. > > Fix this by adding a NULL check of crtc_state, similar to other drivers. > > Fixes: 01e2eaf40c9d ("drm/rockchip: Convert to using __drm_atomic_helper_crtc_reset() for reset.") > Signed-off-by: Jonas Karlman <jonas@xxxxxxxxx> Reviewed-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> Sascha > --- > v2: > - New patch > > drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c > index 25c873d4ff53..23bc79064e78 100644 > --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c > @@ -1630,7 +1630,10 @@ static void vop_crtc_reset(struct drm_crtc *crtc) > if (crtc->state) > vop_crtc_destroy_state(crtc, crtc->state); > > - __drm_atomic_helper_crtc_reset(crtc, &crtc_state->base); > + if (crtc_state) > + __drm_atomic_helper_crtc_reset(crtc, &crtc_state->base); > + else > + __drm_atomic_helper_crtc_reset(crtc, NULL); > } > > #ifdef CONFIG_DRM_ANALOGIX_DP > -- > 2.41.0 > > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |