All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/amd/display: set new_stream to NULL after release
@ 2026-06-28  7:27 WenTao Liang
  2026-06-28  7:33 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: WenTao Liang @ 2026-06-28  7:27 UTC (permalink / raw)
  To: Harry Wentland, Leo Li
  Cc: Rodrigo Siqueira, Alex Deucher, Christian König,
	David Airlie, Simona Vetter, Mario Limonciello, Alex Hung,
	Aurabindo Pillai, amd-gfx, dri-devel, linux-kernel, WenTao Liang,
	stable

In dm_update_crtc_state(), the skip_modeset path releases new_stream
via dc_stream_release() but does not set the pointer to NULL.

If a later error (e.g., color management failure) triggers the fail
label, the error path calls dc_stream_release() again on the same
dangling pointer, causing a double release and potential use-after-free.

Fix this by setting new_stream to NULL after the initial release.

Fixes: 9b690ef3c7042 ("drm/amd/display: Avoid full modeset when not required")
Cc: stable@vger.kernel.org
Signed-off-by: WenTao Liang <vulab@iscas.ac.cn>
---
Changes in v2:
- Correct Fixes hash based on reviewer feedback
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 5fc5d5608506..acf0b01d6f62 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -11708,6 +11708,7 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm,
 	/* Release extra reference */
 	if (new_stream)
 		dc_stream_release(new_stream);
+	new_stream = NULL;
 
 	/*
 	 * We want to do dc stream updates that do not require a
-- 
2.39.5 (Apple Git-154)


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

* Re: [PATCH v2] drm/amd/display: set new_stream to NULL after release
  2026-06-28  7:27 [PATCH v2] drm/amd/display: set new_stream to NULL after release WenTao Liang
@ 2026-06-28  7:33 ` Greg KH
  2026-06-28  7:49   ` WenTao Liang
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2026-06-28  7:33 UTC (permalink / raw)
  To: WenTao Liang
  Cc: Harry Wentland, Leo Li, Rodrigo Siqueira, Alex Deucher,
	Christian König, David Airlie, Simona Vetter,
	Mario Limonciello, Alex Hung, Aurabindo Pillai, amd-gfx,
	dri-devel, linux-kernel, stable

On Sun, Jun 28, 2026 at 03:27:40PM +0800, WenTao Liang wrote:
> In dm_update_crtc_state(), the skip_modeset path releases new_stream
> via dc_stream_release() but does not set the pointer to NULL.
> 
> If a later error (e.g., color management failure) triggers the fail
> label, the error path calls dc_stream_release() again on the same
> dangling pointer, causing a double release and potential use-after-free.
> 
> Fix this by setting new_stream to NULL after the initial release.
> 
> Fixes: 9b690ef3c7042 ("drm/amd/display: Avoid full modeset when not required")
> Cc: stable@vger.kernel.org
> Signed-off-by: WenTao Liang <vulab@iscas.ac.cn>
> ---
> Changes in v2:
> - Correct Fixes hash based on reviewer feedback

Did you forget to include an Assisted-by: tag?

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

* Re: [PATCH v2] drm/amd/display: set new_stream to NULL after release
  2026-06-28  7:33 ` Greg KH
@ 2026-06-28  7:49   ` WenTao Liang
  2026-06-28 19:12     ` Mario Limonciello
  0 siblings, 1 reply; 4+ messages in thread
From: WenTao Liang @ 2026-06-28  7:49 UTC (permalink / raw)
  To: Greg KH
  Cc: Harry Wentland, Leo Li, Rodrigo Siqueira, Alex Deucher,
	Christian König, David Airlie, Simona Vetter,
	Mario Limonciello, Alex Hung, Aurabindo Pillai, amd-gfx,
	dri-devel, linux-kernel, stable

[-- Attachment #1: Type: text/plain, Size: 282 bytes --]



> 2026年6月28日 15:33,Greg KH <gregkh@linuxfoundation.org> 写道:
> 
> Did you forget to include an Assisted-by: tag?

You're right, the Fixes hash correction in v2 was suggested by the reviewer in v1. I'll add a Suggested-by tag in v3. Thanks for pointing this out!

[-- Attachment #2: Type: text/html, Size: 1007 bytes --]

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

* Re: [PATCH v2] drm/amd/display: set new_stream to NULL after release
  2026-06-28  7:49   ` WenTao Liang
@ 2026-06-28 19:12     ` Mario Limonciello
  0 siblings, 0 replies; 4+ messages in thread
From: Mario Limonciello @ 2026-06-28 19:12 UTC (permalink / raw)
  To: WenTao Liang, Greg KH
  Cc: Harry Wentland, Leo Li, Rodrigo Siqueira, Alex Deucher,
	Christian König, David Airlie, Simona Vetter, Alex Hung,
	Aurabindo Pillai, amd-gfx, dri-devel, linux-kernel, stable



On 6/28/26 02:49, WenTao Liang wrote:
> 
> 
>> 2026年6月28日 15:33,Greg KH <gregkh@linuxfoundation.org> 写道:
>>
>> Did you forget to include an Assisted-by: tag?
> 
> You're right, the Fixes hash correction in v2 was suggested by the 
> reviewer in v1. I'll add a Suggested-by tag in v3. Thanks for pointing 
> this out!

I believe Greg is hypothesizing that this mistaken tag was caused by a 
tool/model and you didn't mention the tool that you used.

https://docs.kernel.org/process/coding-assistants.html#attribution

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

end of thread, other threads:[~2026-06-28 19:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-28  7:27 [PATCH v2] drm/amd/display: set new_stream to NULL after release WenTao Liang
2026-06-28  7:33 ` Greg KH
2026-06-28  7:49   ` WenTao Liang
2026-06-28 19:12     ` Mario Limonciello

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.