dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/sysfb: Do not dereference NULL pointer in plane reset
@ 2025-10-17  9:13 Thomas Zimmermann
  2025-10-24  9:16 ` Javier Martinez Canillas
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Zimmermann @ 2025-10-17  9:13 UTC (permalink / raw)
  To: javierm, dan.carpenter, maarten.lankhorst, mripard
  Cc: dri-devel, Thomas Zimmermann, Melissa Wen, David Airlie,
	Simona Vetter, stable

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.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Fixes: b71565022031 ("drm/gem: Export implementation of shadow-plane helpers")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/dri-devel/aPIDAsHIUHp_qSW4@stanley.mountain/
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Melissa Wen <melissa.srw@gmail.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: David Airlie <airlied@gmail.com>
Cc: Simona Vetter <simona@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Cc: <stable@vger.kernel.org> # v5.15+
---
 drivers/gpu/drm/drm_gem_atomic_helper.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_gem_atomic_helper.c b/drivers/gpu/drm/drm_gem_atomic_helper.c
index ebf305fb24f0..6fb55601252f 100644
--- a/drivers/gpu/drm/drm_gem_atomic_helper.c
+++ b/drivers/gpu/drm/drm_gem_atomic_helper.c
@@ -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);
 
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/sysfb: Do not dereference NULL pointer in plane reset
  2025-10-17  9:13 [PATCH] drm/sysfb: Do not dereference NULL pointer in plane reset Thomas Zimmermann
@ 2025-10-24  9:16 ` Javier Martinez Canillas
  2025-10-24 12:08   ` Thomas Zimmermann
  0 siblings, 1 reply; 3+ messages in thread
From: Javier Martinez Canillas @ 2025-10-24  9:16 UTC (permalink / raw)
  To: Thomas Zimmermann, dan.carpenter, maarten.lankhorst, mripard
  Cc: dri-devel, Thomas Zimmermann, Melissa Wen, David Airlie,
	Simona Vetter, stable

Thomas Zimmermann <tzimmermann@suse.de> writes:

Hello Thomas,

> 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.

> deref that pointer, but forward NULL to the other plane-reset helpers.
> Clears plane->state to NULL.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Fixes: b71565022031 ("drm/gem: Export implementation of shadow-plane helpers")
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/dri-devel/aPIDAsHIUHp_qSW4@stanley.mountain/
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Melissa Wen <melissa.srw@gmail.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Simona Vetter <simona@ffwll.ch>
> Cc: dri-devel@lists.freedesktop.org
> Cc: <stable@vger.kernel.org> # v5.15+
> ---
>  drivers/gpu/drm/drm_gem_atomic_helper.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/sysfb: Do not dereference NULL pointer in plane reset
  2025-10-24  9:16 ` Javier Martinez Canillas
@ 2025-10-24 12:08   ` Thomas Zimmermann
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Zimmermann @ 2025-10-24 12:08 UTC (permalink / raw)
  To: Javier Martinez Canillas, dan.carpenter, maarten.lankhorst,
	mripard
  Cc: dri-devel, Melissa Wen, David Airlie, Simona Vetter, stable

Hi

Am 24.10.25 um 11:16 schrieb Javier Martinez Canillas:
> Thomas Zimmermann <tzimmermann@suse.de> writes:
>
> Hello Thomas,
>
>> 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

>
>> deref that pointer, but forward NULL to the other plane-reset helpers.
>> Clears plane->state to NULL.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> Fixes: b71565022031 ("drm/gem: Export implementation of shadow-plane helpers")
>> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
>> Closes: https://lore.kernel.org/dri-devel/aPIDAsHIUHp_qSW4@stanley.mountain/
>> Cc: Thomas Zimmermann <tzimmermann@suse.de>
>> Cc: Melissa Wen <melissa.srw@gmail.com>
>> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> Cc: Maxime Ripard <mripard@kernel.org>
>> Cc: David Airlie <airlied@gmail.com>
>> Cc: Simona Vetter <simona@ffwll.ch>
>> Cc: dri-devel@lists.freedesktop.org
>> Cc: <stable@vger.kernel.org> # v5.15+
>> ---
>>   drivers/gpu/drm/drm_gem_atomic_helper.c | 8 ++++++--
>>   1 file changed, 6 insertions(+), 2 deletions(-)
>>
> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
>

-- 
--
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)



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-10-24 12:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-17  9:13 [PATCH] drm/sysfb: Do not dereference NULL pointer in plane reset Thomas Zimmermann
2025-10-24  9:16 ` Javier Martinez Canillas
2025-10-24 12:08   ` Thomas Zimmermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox