mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fix: drm/amd/display: dm_update_crtc_state: skip_modeset path leaves   new_stream dangling, causing double release
@ 2026-06-26 12:41 WenTao Liang
  2026-06-26 16:45 ` Mario Limonciello
  0 siblings, 1 reply; 3+ messages in thread
From: WenTao Liang @ 2026-06-26 12:41 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, alexander.deucher, christian.koenig,
	airlied, simona
  Cc: siqueira, mario.limonciello, alex.hung, superm1, timur.kristof,
	ivan.lipski, aurabindo.pillai, chen-yu.chen, amd-gfx, dri-devel,
	linux-kernel, WenTao Liang, stable

The skip_modeset path calls dc_stream_release(new_stream) but does not
  set new_stream to NULL. If a subsequent error (e.g., color management
  failure) triggers goto fail, the fail label executes a second
  dc_stream_release on the same pointer, causing a use-after-free or excess
  put on the stream reference.

Cc: stable@vger.kernel.org
Fixes: 3ce51649cdf2 ("drm/amdgpu/display: add quirk handling for stutter mode")
Signed-off-by: WenTao Liang <vulab@iscas.ac.cn>
---
 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	[flat|nested] 3+ messages in thread

* Re: [PATCH] fix: drm/amd/display: dm_update_crtc_state: skip_modeset path leaves new_stream dangling, causing double release
  2026-06-26 12:41 [PATCH] fix: drm/amd/display: dm_update_crtc_state: skip_modeset path leaves new_stream dangling, causing double release WenTao Liang
@ 2026-06-26 16:45 ` Mario Limonciello
  2026-06-27 11:54   ` WenTao Liang
  0 siblings, 1 reply; 3+ messages in thread
From: Mario Limonciello @ 2026-06-26 16:45 UTC (permalink / raw)
  To: WenTao Liang, harry.wentland, sunpeng.li, alexander.deucher,
	christian.koenig, airlied, simona
  Cc: siqueira, alex.hung, superm1, timur.kristof, ivan.lipski,
	aurabindo.pillai, chen-yu.chen, amd-gfx, dri-devel, linux-kernel,
	stable



On 6/26/26 07:41, WenTao Liang wrote:
> The skip_modeset path calls dc_stream_release(new_stream) but does not
>    set new_stream to NULL. If a subsequent error (e.g., color management
>    failure) triggers goto fail, the fail label executes a second
>    dc_stream_release on the same pointer, causing a use-after-free or excess
>    put on the stream reference.
> 
> Cc: stable@vger.kernel.org
> Fixes: 3ce51649cdf2 ("drm/amdgpu/display: add quirk handling for stutter mode")
> Signed-off-by: WenTao Liang <vulab@iscas.ac.cn>

The code change looks good to me, but this Fixes hash doesn't really 
make sense to me.

Are you sure about that?

I /think/ this is the correct hash:

Fixes: 9b690ef3c7042 ("drm/amd/display: Avoid full modeset when not 
required")

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


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

* Re: [PATCH] fix: drm/amd/display: dm_update_crtc_state: skip_modeset path leaves new_stream dangling, causing double release
  2026-06-26 16:45 ` Mario Limonciello
@ 2026-06-27 11:54   ` WenTao Liang
  0 siblings, 0 replies; 3+ messages in thread
From: WenTao Liang @ 2026-06-27 11:54 UTC (permalink / raw)
  To: Mario Limonciello
  Cc: harry.wentland, sunpeng.li, alexander.deucher, christian.koenig,
	airlied, simona, siqueira, alex.hung, superm1, timur.kristof,
	ivan.lipski, aurabindo.pillai, chen-yu.chen, amd-gfx, dri-devel,
	linux-kernel, stable



> 2026年6月27日 00:45,Mario Limonciello <mario.limonciello@amd.com> 写道:
> 
> 
> 
> On 6/26/26 07:41, WenTao Liang wrote:
>> The skip_modeset path calls dc_stream_release(new_stream) but does not
>>   set new_stream to NULL. If a subsequent error (e.g., color management
>>   failure) triggers goto fail, the fail label executes a second
>>   dc_stream_release on the same pointer, causing a use-after-free or excess
>>   put on the stream reference.
>> Cc: stable@vger.kernel.org
>> Fixes: 3ce51649cdf2 ("drm/amdgpu/display: add quirk handling for stutter mode")
>> Signed-off-by: WenTao Liang <vulab@iscas.ac.cn>
> 
> The code change looks good to me, but this Fixes hash doesn't really make sense to me.
> 
> Are you sure about that?
> 
> I /think/ this is the correct hash:
> 
> Fixes: 9b690ef3c7042 ("drm/amd/display: Avoid full modeset when not required")
> 
>> ---
>>  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



Thank you for the review and for catching this. You are right — I used
the wrong Fixes hash. The correct one is indeed:

Fixes: 9b690ef3c7042 ("drm/amd/display: Avoid full modeset when not required")

I will update it in the next version.

Thanks again for your help.

Best regards,
WenTao Liang


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

end of thread, other threads:[~2026-06-27 11:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-26 12:41 [PATCH] fix: drm/amd/display: dm_update_crtc_state: skip_modeset path leaves new_stream dangling, causing double release WenTao Liang
2026-06-26 16:45 ` Mario Limonciello
2026-06-27 11:54   ` WenTao Liang

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

all inboxes | Powered by JetHome®