Skip to content

Commit 27227a2

Browse files
Joshua Aberbackalexdeucher
authored andcommitted
drm/amd/display: Fix handling of plane refcount
[Why] The mechanism to backup and restore plane states doesn't maintain refcount, which can cause issues if the refcount of the plane changes in between backup and restore operations, such as memory leaks if the refcount was supposed to go down, or double frees / invalid memory accesses if the refcount was supposed to go up. [How] Cache and re-apply current refcount when restoring plane states. Cc: [email protected] Reviewed-by: Josip Pavic <[email protected]> Signed-off-by: Joshua Aberback <[email protected]> Signed-off-by: Hamza Mahfooz <[email protected]> Tested-by: Daniel Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent c33a932 commit 27227a2

File tree

1 file changed

+3
-0
lines changed
  • drivers/gpu/drm/amd/display/dc/core

1 file changed

+3
-0
lines changed

drivers/gpu/drm/amd/display/dc/core/dc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3141,7 +3141,10 @@ static void restore_planes_and_stream_state(
31413141
return;
31423142

31433143
for (i = 0; i < status->plane_count; i++) {
3144+
/* refcount will always be valid, restore everything else */
3145+
struct kref refcount = status->plane_states[i]->refcount;
31443146
*status->plane_states[i] = scratch->plane_states[i];
3147+
status->plane_states[i]->refcount = refcount;
31453148
}
31463149
*stream = scratch->stream_state;
31473150
}

0 commit comments

Comments
 (0)