Skip to contentSkip to conversation

drm/sysfb: Do not dereference NULL pointer in plane reset

PATCH In review Thomas Zimmermann 2 participants 3 messages Oct 17, 2025 – Oct 24, 2025

Subsystems (3)
lore
Share & tools
lore

Thomas Zimmermann

author maintainer
#0 lore raw

PATCH 1/1 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.

Fixes b71565022031 ("drm/gem: Export implementation of shadow-plane helpers")
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]> # v5.15+
---
 drivers/gpu/drm/drm_gem_atomic_helper.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_gem_atomic_helper.c +6 -2
index ebf305fb24f0..6fb55601252f 100644
@@ -310,8 +310,12 @@ EXPORT_SYMBOL(drm_gem_destroy_shadow_plane_state);
 void __drm_gem_reset_shadow_plane(struct drm_plane *plane,
 				  struct drm_shadow_plane_state *shadow_plane_state)
 {
-	__drm_atomic_helper_plane_reset(plane, &shadow_plane_state->base);
-	drm_format_conv_state_init(&shadow_plane_state->fmtcnv_state);
+	if (shadow_plane_state) {
+		__drm_atomic_helper_plane_reset(plane, &shadow_plane_state->base);
+		drm_format_conv_state_init(&shadow_plane_state->fmtcnv_state);
+	} else {
+		__drm_atomic_helper_plane_reset(plane, NULL);
+	}
 }
 EXPORT_SYMBOL(__drm_gem_reset_shadow_plane);
 
Signature · 1 line
2.51.0
Reviewed-by on v1 1/1
#1 lore raw

Thomas Zimmermann <[email protected]> writes:

Hello Thomas,

Quoted 1 line

The plane state in __drm_gem_reset_shadow_plane) can be NULL. Do not

That ) is off. I guess you meant either () or just the function name.

Quoted 15 lines

deref that pointer, but forward NULL to the other plane-reset helpers. Clears plane->state to NULL.

Fixes b71565022031 ("drm/gem: Export implementation of shadow-plane helpers")
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]> # v5.15+
Quoted 4 lines
---
 drivers/gpu/drm/drm_gem_atomic_helper.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
Signature · 5 lines
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat
author maintainer
#2 lore raw

Hi

Am 24.10.25 um 11:16 schrieb Javier Martinez Canillas:

Quoted 6 lines

Thomas Zimmermann <[email protected]> writes:

Hello Thomas,

Quoted 1 line

The plane state in __drm_gem_reset_shadow_plane) can be NULL. Do not

That ) is off. I guess you meant either () or just the function name.

Oh, indeed. I'll fix that when I land the patch.

Best regards
Thomas

Quoted 22 lines
Quoted 16 lines

deref that pointer, but forward NULL to the other plane-reset helpers. Clears plane->state to NULL.

Fixes b71565022031 ("drm/gem: Export implementation of shadow-plane helpers")
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]> # v5.15+
Quoted 4 lines
---
  drivers/gpu/drm/drm_gem_atomic_helper.c | 8 ++++++--
  1 file changed, 6 insertions(+), 2 deletions(-)
Signature · 7 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)