summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-10-17 15:32:01 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-01-07 12:07:37 +0100
commit080569aa3c505c591a5253f84f76a5a3735a11ea (patch)
tree2c53776d9d67a56cb313877976a361e9a874961b
parent73adc289cd1e16727fc35c5239e66c40f5ef78c3 (diff)
downloadlinux-stable-080569aa3c505c591a5253f84f76a5a3735a11ea.tar.gz
linux-stable-080569aa3c505c591a5253f84f76a5a3735a11ea.tar.bz2
linux-stable-080569aa3c505c591a5253f84f76a5a3735a11ea.zip
drm/connector: send hotplug uevent on connector cleanup
commit 6fdc2d490ea1369d17afd7e6eb66fecc5b7209bc upstream. A typical DP-MST unplug removes a KMS connector. However care must be taken to properly synchronize with user-space. The expected sequence of events is the following: 1. The kernel notices that the DP-MST port is gone. 2. The kernel marks the connector as disconnected, then sends a uevent to make user-space re-scan the connector list. 3. User-space notices the connector goes from connected to disconnected, disables it. 4. Kernel handles the IOCTL disabling the connector. On success, the very last reference to the struct drm_connector is dropped and drm_connector_cleanup() is called. 5. The connector is removed from the list, and a uevent is sent to tell user-space that the connector disappeared. The very last step was missing. As a result, user-space thought the connector still existed and could try to disable it again. Since the kernel no longer knows about the connector, that would end up with EINVAL and confused user-space. Fix this by sending a hotplug uevent from drm_connector_cleanup(). Signed-off-by: Simon Ser <contact@emersion.fr> Cc: stable@vger.kernel.org Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Lyude Paul <lyude@redhat.com> Cc: Jonas Ådahl <jadahl@redhat.com> Tested-by: Jonas Ådahl <jadahl@redhat.com> Reviewed-by: Lyude Paul <lyude@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20221017153150.60675-2-contact@emersion.fr Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/gpu/drm/drm_connector.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 0e934a9ac63c..86529c0b1ed4 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -363,6 +363,9 @@ void drm_connector_cleanup(struct drm_connector *connector)
mutex_destroy(&connector->mutex);
memset(connector, 0, sizeof(*connector));
+
+ if (dev->registered)
+ drm_sysfs_hotplug_event(dev);
}
EXPORT_SYMBOL(drm_connector_cleanup);