drm/amd/display: Fix accessing freed memory
authorCorbin McElhanney <corbin.mcelhanney@amd.com>
Thu, 3 Aug 2017 22:29:42 +0000 (18:29 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 26 Sep 2017 22:16:23 +0000 (18:16 -0400)
Signed-off-by: Corbin McElhanney <corbin.mcelhanney@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc.c

index f305780c36cec7706c3352ca1cdaec3fc68277c5..b69a726717d98778caa1ec5dfbfd72d53698b557 100644 (file)
@@ -1714,8 +1714,11 @@ void dc_update_planes_and_stream(struct dc *dc,
        }
 
        if (core_dc->current_context != context) {
-               dc_release_validate_context(core_dc->current_context);
+               struct validate_context *old = core_dc->current_context;
+
                core_dc->current_context = context;
+               dc_release_validate_context(old);
+
        }
        return;