drm/dp_mst: Fix payload deallocation on hotplugs using malloc refs
authorLyude Paul <lyude@redhat.com>
Fri, 11 Jan 2019 00:53:32 +0000 (19:53 -0500)
committerLyude Paul <lyude@redhat.com>
Fri, 11 Jan 2019 01:12:23 +0000 (20:12 -0500)
commitcfe9f90358d97a83253443b0182bff1222d3a7ac
treee842d8293846d1319a3a305e2dbbd4c7205f0d63
parenta68f9917721bba02de43f728e31426f2384cb961
drm/dp_mst: Fix payload deallocation on hotplugs using malloc refs

Up until now, freeing payloads on remote MST hubs that just had ports
removed has almost never worked because we've been relying on port
validation in order to stop us from accessing ports that have already
been freed from memory, but ports which need their payloads released due
to being removed will never be a valid part of the topology after
they've been removed.

Since we've introduced malloc refs, we can replace all of the validation
logic in payload helpers which are used for deallocation with some
well-placed malloc krefs. This ensures that regardless of whether or not
the ports are still valid and in the topology, any port which has an
allocated payload will remain allocated in memory until it's payloads
have been removed - finally allowing us to actually release said
payloads correctly.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Cc: David Airlie <airlied@redhat.com>
Cc: Jerry Zuo <Jerry.Zuo@amd.com>
Cc: Juston Li <juston.li@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190111005343.17443-10-lyude@redhat.com
drivers/gpu/drm/drm_dp_mst_topology.c