mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 00:53:34 +02:00
drm/amd/display: Persist stream refcount through restore
[Why & How] Overwriting the refcount on stream restore can lead to double-free errors or memory leaks if an unbalanced number of retains and releases occurs between a backup and restore. Reviewed-by: Dillon Varone <dillon.varone@amd.com> Signed-off-by: Joshua Aberback <joshua.aberback@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
717b836c27
commit
b0ba3108e3
|
|
@ -3389,7 +3389,11 @@ static void restore_planes_and_stream_state(
|
|||
for (i = 0; i < status->plane_count; i++) {
|
||||
dc_plane_copy_config(status->plane_states[i], &scratch->plane_states[i]);
|
||||
}
|
||||
|
||||
// refcount is persistent
|
||||
struct kref temp_refcount = stream->refcount;
|
||||
*stream = scratch->stream_state;
|
||||
stream->refcount = temp_refcount;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user