Skip to content

Commit 14e02ed

Browse files
committed
drm/sysfb: Do not dereference NULL pointer in plane reset
The plane state in __drm_gem_reset_shadow_plane() can be NULL. Do not deref that pointer, but forward NULL to the other plane-reset helpers. Clears plane->state to NULL. v2: - fix typo in commit description (Javier) Signed-off-by: Thomas Zimmermann <[email protected]> Fixes: b715650 ("drm/gem: Export implementation of shadow-plane helpers") Reported-by: Dan Carpenter <[email protected]> Closes: https://lore.kernel.org/dri-devel/[email protected]/ Cc: Thomas Zimmermann <[email protected]> Cc: Melissa Wen <[email protected]> Cc: Maarten Lankhorst <[email protected]> Cc: Maxime Ripard <[email protected]> Cc: David Airlie <[email protected]> Cc: Simona Vetter <[email protected]> Cc: [email protected] Cc: <[email protected]> # v5.15+ Reviewed-by: Javier Martinez Canillas <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 0335594 commit 14e02ed

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/gpu/drm/drm_gem_atomic_helper.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,12 @@ EXPORT_SYMBOL(drm_gem_destroy_shadow_plane_state);
310310
void __drm_gem_reset_shadow_plane(struct drm_plane *plane,
311311
struct drm_shadow_plane_state *shadow_plane_state)
312312
{
313-
__drm_atomic_helper_plane_reset(plane, &shadow_plane_state->base);
314-
drm_format_conv_state_init(&shadow_plane_state->fmtcnv_state);
313+
if (shadow_plane_state) {
314+
__drm_atomic_helper_plane_reset(plane, &shadow_plane_state->base);
315+
drm_format_conv_state_init(&shadow_plane_state->fmtcnv_state);
316+
} else {
317+
__drm_atomic_helper_plane_reset(plane, NULL);
318+
}
315319
}
316320
EXPORT_SYMBOL(__drm_gem_reset_shadow_plane);
317321

0 commit comments

Comments
 (0)