Message ID | 20230621223311.2239547-4-jonas@kwiboo.se (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/rockchip: Fix crtc duplicate state and crtc reset funcs | expand |
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@kwiboo.se> Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de> 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 > >
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
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@kwiboo.se> --- v2: - New patch drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)