drm/amdgpu: take the mode_config mutex when handling hpds
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / drm / amd / amdgpu / amdgpu_irq.c
index 2187960baf7cdb43d783cc157594320b7254d5d1..b4d36f0f2153c7d4b4e168980f9b7ab91238296b 100644 (file)
@@ -59,10 +59,12 @@ static void amdgpu_hotplug_work_func(struct work_struct *work)
        struct drm_mode_config *mode_config = &dev->mode_config;
        struct drm_connector *connector;
 
+       mutex_lock(&mode_config->mutex);
        if (mode_config->num_connector) {
                list_for_each_entry(connector, &mode_config->connector_list, head)
                        amdgpu_connector_hotplug(connector);
        }
+       mutex_unlock(&mode_config->mutex);
        /* Just fire off a uevent and let userspace tell us what to do */
        drm_helper_hpd_irq_event(dev);
 }