Skip to content

Commit

Permalink
drm/connector: notify userspace on hotplug after register complete
Browse files Browse the repository at this point in the history
drm connector notifies userspace on hotplug event prematurely before
late_register and mode_object register completes. This leads to a race
between userspace and kernel on updating the IDR list. So, move the
notification to end of connector register.

Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Steve Cohen <cohens@codeaurora.org>
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/1591155451-10393-1-git-send-email-jsanka@codeaurora.org
  • Loading branch information
Jeykumar Sankaran authored and Daniel Vetter committed Jun 3, 2020
1 parent 9ca1f47 commit 968d81a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 5 additions & 0 deletions drivers/gpu/drm/drm_connector.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <drm/drm_print.h>
#include <drm/drm_drv.h>
#include <drm/drm_file.h>
#include <drm/drm_sysfs.h>

#include <linux/uaccess.h>

Expand Down Expand Up @@ -523,6 +524,10 @@ int drm_connector_register(struct drm_connector *connector)
drm_mode_object_register(connector->dev, &connector->base);

connector->registration_state = DRM_CONNECTOR_REGISTERED;

/* Let userspace know we have a new connector */
drm_sysfs_hotplug_event(connector->dev);

goto unlock;

err_debugfs:
Expand Down
3 changes: 0 additions & 3 deletions drivers/gpu/drm/drm_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,6 @@ int drm_sysfs_connector_add(struct drm_connector *connector)
return PTR_ERR(connector->kdev);
}

/* Let userspace know we have a new connector */
drm_sysfs_hotplug_event(dev);

if (connector->ddc)
return sysfs_create_link(&connector->kdev->kobj,
&connector->ddc->dev.kobj, "ddc");
Expand Down

0 comments on commit 968d81a

Please sign in to comment.