Skip to content

Commit 471bf24

Browse files
trettermmind
authored andcommitted
drm/rockchip: vop2: fix null pointer in plane_atomic_disable
If the vop2_plane_atomic_disable function is called with NULL as a state, accessing the old_pstate runs into a null pointer exception. However, the drm_atomic_helper_disable_planes_on_crtc function calls the atomic_disable callback with state NULL. Allow to disable a plane without passing a plane state by checking the old_pstate only if a state is passed. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Heiko Stuebner <heiko@sntech.de> Link: https://patchwork.freedesktop.org/patch/msgid/20221028095206.2136601-2-m.tretter@pengutronix.de
1 parent 553c5a4 commit 471bf24

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/gpu/drm/rockchip/rockchip_drm_vop2.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -996,13 +996,15 @@ static int vop2_plane_atomic_check(struct drm_plane *plane,
996996
static void vop2_plane_atomic_disable(struct drm_plane *plane,
997997
struct drm_atomic_state *state)
998998
{
999-
struct drm_plane_state *old_pstate = drm_atomic_get_old_plane_state(state, plane);
999+
struct drm_plane_state *old_pstate = NULL;
10001000
struct vop2_win *win = to_vop2_win(plane);
10011001
struct vop2 *vop2 = win->vop2;
10021002

10031003
drm_dbg(vop2->drm, "%s disable\n", win->data->name);
10041004

1005-
if (!old_pstate->crtc)
1005+
if (state)
1006+
old_pstate = drm_atomic_get_old_plane_state(state, plane);
1007+
if (old_pstate && !old_pstate->crtc)
10061008
return;
10071009

10081010
vop2_win_disable(win);

0 commit comments

Comments
 (0)