Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: warn if dp aux is still attached on free

If this happens (and it recently did), we free a structure while part of
it is still in use, which results in non-obvious crashes. The way it's
detached is not trivial (DRM core has to call the connector .destroy
callback and things must be torn down in the right order), so better
detect it and warn early.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Grazvydas Ignotas and committed by
Alex Deucher
2f9ba199 140c94da

+4 -1
+3 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
··· 769 769 { 770 770 struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector); 771 771 772 - if (amdgpu_connector->ddc_bus->has_aux) 772 + if (amdgpu_connector->ddc_bus->has_aux) { 773 773 drm_dp_aux_unregister(&amdgpu_connector->ddc_bus->aux); 774 + amdgpu_connector->ddc_bus->has_aux = false; 775 + } 774 776 amdgpu_connector_free_edid(connector); 775 777 kfree(amdgpu_connector->con_priv); 776 778 drm_connector_unregister(connector);
+1
drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c
··· 220 220 { 221 221 if (!i2c) 222 222 return; 223 + WARN_ON(i2c->has_aux); 223 224 i2c_del_adapter(&i2c->adapter); 224 225 kfree(i2c); 225 226 }